$detail = 'The current user is not allowed to view this relationship.';
if (!
$entity->
access('view'
) &&
$entity->
access('view label'
) &&
$access instanceof AccessResultReasonInterface &&
empty($access->
getReason())) { $access->
setReason("The user only has authorization for the 'view label' operation."
);
} $via_link = Url::
fromRoute( sprintf('jsonapi.%s.%s.related',
$base_resource_identifier['type'
],
$relationship_field_name),
['entity' =>
$base_resource_identifier['id'
]] );
$related_response =
static::
getAccessDeniedResponse($entity,
$access,
$via_link,
$relationship_field_name,
$detail, FALSE
);
} else { $self_link =
static::
getRelatedLink($base_resource_identifier,
$relationship_field_name);
$relationship_response =
$this->
getExpectedGetRelationshipResponse($relationship_field_name,
$entity);
$relationship_document =
$relationship_response->
getResponseData();
// The relationships may be empty, in which case we shouldn't attempt to
// fetch the individual identified resources.
if (empty($relationship_document['data'
])) { $cache_contexts = Cache::
mergeContexts([ // Cache contexts for JSON:API URL query parameters.
'url.query_args:fields',
'url.query_args:include',
// Drupal defaults.
'url.site',
],