function JsonApiDocumentTopLevelNormalizer::getLinkHash

Same name in other branches
  1. 9 core/modules/jsonapi/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php \Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer::getLinkHash()
  2. 8.9.x core/modules/jsonapi/src/Normalizer/JsonApiDocumentTopLevelNormalizer.php \Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer::getLinkHash()
  3. 10 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 326

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.