mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 00:06:55 +02:00
Fix issue processwire/processwire-issues#264
This commit is contained in:
@@ -683,13 +683,26 @@ class PageFinder extends Wire {
|
|||||||
} else if($quote == '(') {
|
} else if($quote == '(') {
|
||||||
// selector contains an OR group (quoted selector)
|
// selector contains an OR group (quoted selector)
|
||||||
// at least one (quoted selector) must match for each field specified in front of it
|
// 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(!$groupName) $groupName = 'none';
|
||||||
if(!isset($this->extraOrSelectors[$groupName])) $this->extraOrSelectors[$groupName] = array();
|
if(!isset($this->extraOrSelectors[$groupName])) $this->extraOrSelectors[$groupName] = array();
|
||||||
if($selector->value instanceof Selectors) {
|
if($selector->value instanceof Selectors) {
|
||||||
$this->extraOrSelectors[$groupName][] = $selector->value;
|
$this->extraOrSelectors[$groupName][] = $selector->value;
|
||||||
} else {
|
} 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;
|
return false;
|
||||||
|
|
||||||
|
@@ -423,7 +423,7 @@ class Selectors extends WireArray {
|
|||||||
}
|
}
|
||||||
$group = $this->extractGroup($str);
|
$group = $this->extractGroup($str);
|
||||||
$field = $this->extractField($str);
|
$field = $this->extractField($str);
|
||||||
$operator = $this->extractOperator($str, $this->getOperatorChars());
|
$operator = $this->extractOperator($str, self::getOperatorChars());
|
||||||
$value = $this->extractValue($str, $quote);
|
$value = $this->extractValue($str, $quote);
|
||||||
|
|
||||||
if($this->parseVars && $quote == '[' && $this->valueHasVar($value)) {
|
if($this->parseVars && $quote == '[' && $this->valueHasVar($value)) {
|
||||||
|
Reference in New Issue
Block a user