protected function FieldResolver::constructInternalPath in Drupal 9
Same name and namespace in other branches
- 8 core/modules/jsonapi/src/Context/FieldResolver.php \Drupal\jsonapi\Context\FieldResolver::constructInternalPath()
- 10 core/modules/jsonapi/src/Context/FieldResolver.php \Drupal\jsonapi\Context\FieldResolver::constructInternalPath()
Expands the internal path with the "entity" keyword.
Parameters
string[] $references: The resolved internal field names of all entity references.
string[] $property_path: (optional) A sub-property path for the last field in the path.
Return value
string The expanded and imploded path.
1 call to FieldResolver::constructInternalPath()
- FieldResolver::resolveInternalEntityQueryPath in core/
modules/ jsonapi/ src/ Context/ FieldResolver.php - Resolves external field expressions into entity query compatible paths.
File
- core/
modules/ jsonapi/ src/ Context/ FieldResolver.php, line 464
Class
- FieldResolver
- A service that evaluates external path expressions against Drupal fields.
Namespace
Drupal\jsonapi\ContextCode
protected function constructInternalPath(array $references, array $property_path = []) {
// Reconstruct the path parts that are referencing sub-properties.
$field_path = implode('.', array_map(function ($part) {
return str_replace('drupal_internal__', '', $part);
}, $property_path));
// This rebuilds the path from the real, internal field names that have
// been traversed so far. It joins them with the "entity" keyword as
// required by the entity query system.
$entity_path = implode('.', $references);
// Reconstruct the full path to the final reference field.
return empty($field_path) ? $entity_path : $entity_path . '.' . $field_path;
}