Skip to content

Commit

Permalink
Support OR conditions for content extract
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Seel authored Jul 21, 2016
1 parent 61a956e commit 01841b8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Command/ExtractCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,15 @@ public function extractContent($folder, $options)

// Prepare the criteria for this context
$contextCriteria = ($criteria) ? $criteria : array();
$contextCriteria['context_key'] = $contextKey;
if (count(array_filter(array_keys($contextCriteria), 'is_string')) > 0) {
// associative array => and conditions
$contextCriteria['context_key'] = $contextKey;
} else {
// sequential array => or conidtions
foreach ($contextCriteria as $i => $orCondition) {
$contextCriteria[$i]['context_key'] = $contextKey;
}
}

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

0 comments on commit 01841b8

Please sign in to comment.