Skip to content

Commit 7022bcf

Browse files
Christian SeelMark-H
authored andcommitted
Support OR conditions for content extract
1 parent cf73e77 commit 7022bcf

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Command/ExtractCommand.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,15 @@ public function extractContent($folder, $options)
109109

110110
// Prepare the criteria for this context
111111
$contextCriteria = ($criteria) ? $criteria : array();
112-
$contextCriteria['context_key'] = $contextKey;
112+
if (count(array_filter(array_keys($contextCriteria), 'is_string')) > 0) {
113+
// associative array => and conditions
114+
$contextCriteria['context_key'] = $contextKey;
115+
} else {
116+
// sequential array => or conidtions
117+
foreach ($contextCriteria as $i => $orCondition) {
118+
$contextCriteria[$i]['context_key'] = $contextKey;
119+
}
120+
}
113121

114122
// Grab the count
115123
$count = $this->modx->getCount('modResource', $contextCriteria);

0 commit comments

Comments
 (0)