protected function FieldResolver::isMemberFilterable in JSON:API 8.2
Determines if the given field or member name is filterable.
Parameters
string $external_name: The external field or member name.
\Drupal\jsonapi\ResourceType\ResourceType[] $resource_types: The resource types to test.
Return value
bool Whether the given field is present as a filterable member of the targeted resource objects.
1 call to FieldResolver::isMemberFilterable()
- FieldResolver::resolveInternalEntityQueryPath in src/
Context/ FieldResolver.php - Resolves external field expressions into entity query compatible paths.
File
- src/
Context/ FieldResolver.php, line 528
Class
- FieldResolver
- A service that evaluates external path expressions against Drupal fields.
Namespace
Drupal\jsonapi\ContextCode
protected function isMemberFilterable($external_name, array $resource_types) {
return array_reduce($resource_types, function ($carry, ResourceType $resource_type) use ($external_name) {
// @todo: remove the next line and uncomment the following one in https://www.drupal.org/project/jsonapi/issues/3017047.
return $carry ?: $external_name === 'id' || $resource_type
->isFieldEnabled($resource_type
->getInternalName($external_name));
/*return $carry ?: in_array($external_name, ['id', 'type']) || $resource_type->isFieldEnabled($resource_type->getInternalName($external_name));*/
}, FALSE);
}