// When the specifier is an entity reference, it can contain an entity
// type specifier, like so: `entity:node`. This extracts the `entity`
// portion. JSON:API will have already validated that the property
// exists.
$split_specifier =
explode(':',
$specifier, 2
);
[$property_name,
$target_entity_type_id] =
array_merge($split_specifier,
count($split_specifier) === 2 ?
[] :
[NULL
]);
// The specifier is either a field property or a delta. If it is a data
// reference or a delta, then it needs to be traversed to the next
// specifier. However, if the specific is a simple field property, i.e.
// it is neither a data reference nor a delta, then there is no need to
// evaluate the remaining specifiers.
$property_definition =
$field_storage_definition->
getPropertyDefinition($property_name);
if ($property_definition instanceof DataReferenceDefinitionInterface
) { // Because the filter is following an entity reference, ensure
// access is respected on those targeted entities.
// Examples:
// - node_query_node_access_alter()
$target_entity_type_id =
$target_entity_type_id ?:
$field_storage_definition->
getSetting('target_type'
);
$query->
addTag("{
$target_entity_type_id}_access"
);
static::
applyAccessConditions($query,
$target_entity_type_id,
$child_prefix,
$cacheability);
// Keep descending the tree.
static::
secureQuery($query,
$target_entity_type_id,
$children,
$cacheability,
$child_prefix);
}