protected function FieldResolver::getInternalName in JSON:API 8
Same name and namespace in other branches
- 8.2 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 src/
Context/ FieldResolver.php - Resolves external field expressions into entity query compatible paths.
File
- src/
Context/ FieldResolver.php, line 422
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 $resource_type
->getInternalName($field_name);
}, $field_name);
}