function FieldResolver::isMemberFilterable
Same name in other branches
- 8.9.x core/modules/jsonapi/src/Context/FieldResolver.php \Drupal\jsonapi\Context\FieldResolver::isMemberFilterable()
- 10 core/modules/jsonapi/src/Context/FieldResolver.php \Drupal\jsonapi\Context\FieldResolver::isMemberFilterable()
- 11.x core/modules/jsonapi/src/Context/FieldResolver.php \Drupal\jsonapi\Context\FieldResolver::isMemberFilterable()
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 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 550
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/drupal/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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.