Skip to content

Create a Hash

Willi edited this page Apr 10, 2018 · 1 revision

Create a Hash of the uuid of an Entity and the settings.php

function my_module_hash_uuid(<entity_id>) {
  $entity = \Drupal::entityTypeManager()->getStorage('<entity_type>')->load(<entity_id>);
  $uuid = $entity->uuid->value ?? FALSE;
  return ($uuid != FALSE ? Crypt::hmacBase64($uuid, Settings::getHashSalt()) : FALSE);
}