protected function FieldResolver::getInternalName in Drupal 9
Same name and namespace in other branches
- 8 core/modules/jsonapi/src/Context/FieldResolver.php \Drupal\jsonapi\Context\FieldResolver::getInternalName()
Resolves the internal field name based on a collection of resource types.
Parameters
string $field_name: The external field name.
\Drupal\jsonapi\ResourceType\ResourceType[] $resource_types: The resource types from which to get an internal name.
Return value
string The resolved internal name.
1 call to FieldResolver::getInternalName()
- 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 528
Class
- FieldResolver
- A service that evaluates external path expressions against Drupal fields.
Namespace
Drupal\jsonapi\ContextCode
protected function getInternalName($field_name, array $resource_types) {
return array_reduce($resource_types, function ($carry, ResourceType $resource_type) use ($field_name) {
if ($carry != $field_name) {
// We already found the internal name.
return $carry;
}
return $field_name === 'id' ? $this
->getIdFieldName($resource_type) : $resource_type
->getInternalName($field_name);
}, $field_name);
}