if (empty($normalized_omissions)) { return new CacheableOmission($cacheability);
} $omission_links =
[ 'detail' => 'Some resources have been omitted because of insufficient authorization.',
'links' =>
[ 'help' =>
[ 'href' => 'https://www.drupal.org/docs/8/modules/json-api/filtering#filters-access-control',
],
],
];
$link_hash_salt = Crypt::
randomBytesBase64();
foreach ($normalized_omissions as $omission) { $cacheability->
addCacheableDependency($omission);
// Add the errors to the pre-existing errors.
foreach ($omission->
getNormalization() as $error) { // JSON:API links cannot be arrays and the spec generally favors link
// relation types as keys. 'item' is the right link relation type, but
// we need multiple values. To do that, we generate a meaningless,
// random value to use as a unique key. That value is a hash of a
// random salt and the link href. This ensures that the key is non-
// deterministic while letting use deduplicate the links by their
// href. The salt is *not* used for any cryptographic reason.