You are here

protected static function JsonApiDocumentTopLevelNormalizer::getLinkHash in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php \Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer::getLinkHash()

Hashes an omitted link.

Parameters

string $salt: A hash salt.

string $link_href: The omitted link.

Return value

string A 7 character hash.

1 call to JsonApiDocumentTopLevelNormalizer::getLinkHash()
JsonApiDocumentTopLevelNormalizer::normalizeOmissionsLinks in core/modules/jsonapi/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php
Normalizes omitted data into a set of omission links.

File

core/modules/jsonapi/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php, line 331

Class

JsonApiDocumentTopLevelNormalizer
Normalizes the top-level document according to the JSON:API specification.

Namespace

Drupal\jsonapi\Normalizer

Code

protected static function getLinkHash($salt, $link_href) {
  return substr(str_replace([
    '-',
    '_',
  ], '', Crypt::hashBase64($salt . $link_href)), 0, 7);
}