protected static function TemporaryQueryGuard::buildTree in Drupal 8
Same name and namespace in other branches
- 9 core/modules/jsonapi/src/Access/TemporaryQueryGuard.php \Drupal\jsonapi\Access\TemporaryQueryGuard::buildTree()
- 10 core/modules/jsonapi/src/Access/TemporaryQueryGuard.php \Drupal\jsonapi\Access\TemporaryQueryGuard::buildTree()
Copied from \Drupal\jsonapi\IncludeResolver.
See also
\Drupal\jsonapi\IncludeResolver::buildTree()
1 call to TemporaryQueryGuard::buildTree()
- TemporaryQueryGuard::applyAccessControls in core/
modules/ jsonapi/ src/ Access/ TemporaryQueryGuard.php - Applies access controls to an entity query.
File
- core/
modules/ jsonapi/ src/ Access/ TemporaryQueryGuard.php, line 585
Class
- TemporaryQueryGuard
- Adds sufficient access control to collection queries.
Namespace
Drupal\jsonapi\AccessCode
protected static function buildTree(array $paths) {
$merged = [];
foreach ($paths as $parts) {
// This complex expression is needed to handle the string, "0", which
// would be evaluated as FALSE.
if (!is_null($field_name = array_shift($parts))) {
$previous = isset($merged[$field_name]) ? $merged[$field_name] : [];
$merged[$field_name] = array_merge($previous, [
$parts,
]);
}
}
return !empty($merged) ? array_map([
static::class,
__FUNCTION__,
], $merged) : $merged;
}