1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-10 00:37:02 +02:00
This commit is contained in:
Ryan Cramer
2017-06-23 09:04:14 -04:00
parent 8107d5e90d
commit 5b0eb5ea81
2 changed files with 16 additions and 3 deletions

View File

@@ -683,13 +683,26 @@ class PageFinder extends Wire {
} else if($quote == '(') {
// selector contains an OR group (quoted selector)
// at least one (quoted selector) must match for each field specified in front of it
$groupName = $this->wire('sanitizer')->fieldName($selector->getField('string'));
$groupName = $selector->group ? $selector->group : $selector->getField('string');
$groupName = $this->wire('sanitizer')->fieldName($groupName);
if(!$groupName) $groupName = 'none';
if(!isset($this->extraOrSelectors[$groupName])) $this->extraOrSelectors[$groupName] = array();
if($selector->value instanceof Selectors) {
$this->extraOrSelectors[$groupName][] = $selector->value;
} else {
$this->extraOrSelectors[$groupName][] = $this->wire(new Selectors($selector->value));
if($selector->group) {
// group is pre-identified, indicating Selector field=value is the OR-group condition
$s = clone $selector;
$s->quote = '';
$s->group = null;
$groupSelectors = new Selectors();
$groupSelectors->add($s);
} else {
// selector field is group name and selector value is another selector containing OR-group condition
$groupSelectors = new Selectors($selector->value);
}
$this->wire($groupSelectors);
$this->extraOrSelectors[$groupName][] = $groupSelectors;
}
return false;

View File

@@ -423,7 +423,7 @@ class Selectors extends WireArray {
}
$group = $this->extractGroup($str);
$field = $this->extractField($str);
$operator = $this->extractOperator($str, $this->getOperatorChars());
$operator = $this->extractOperator($str, self::getOperatorChars());
$value = $this->extractValue($str, $quote);
if($this->parseVars && $quote == '[' && $this->valueHasVar($value)) {