protected function Condition::matchArray in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Config/Entity/Query/Condition.php \Drupal\Core\Config\Entity\Query\Condition::matchArray()
Matches for an array representing one or more config paths.
Parameters
array $condition: The condition array as created by the condition() method.
array $data: The config array or part of it.
array $needs_matching: The list of config array keys needing a match. Can contain config keys and the * wildcard.
array $parents: The current list of parents.
Return value
bool TRUE when the condition matched to the data else FALSE.
1 call to Condition::matchArray()
- Condition::compile in core/
lib/ Drupal/ Core/ Config/ Entity/ Query/ Condition.php - Compiles this conditional clause.
File
- core/
lib/ Drupal/ Core/ Config/ Entity/ Query/ Condition.php, line 118 - Contains \Drupal\Core\Config\Entity\Query\Condition.
Class
- Condition
- Defines the condition class for the config entity query.
Namespace
Drupal\Core\Config\Entity\QueryCode
protected function matchArray(array $condition, array $data, array $needs_matching, array $parents = array()) {
$parent = array_shift($needs_matching);
if ($parent === '*') {
$candidates = array_keys($data);
}
else {
// Avoid a notice when calling match() later.
if (!isset($data[$parent])) {
$data[$parent] = NULL;
}
$candidates = array(
$parent,
);
}
foreach ($candidates as $key) {
if ($needs_matching) {
if (is_array($data[$key])) {
$new_parents = $parents;
$new_parents[] = $key;
if ($this
->matchArray($condition, $data[$key], $needs_matching, $new_parents)) {
return TRUE;
}
}
}
elseif ($this
->match($condition, $data[$key])) {
return TRUE;
}
}
return FALSE;
}