function EntityReferenceItemNormalizer::getUuid

Same name in other branches
  1. 9 core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php \Drupal\hal\Normalizer\EntityReferenceItemNormalizer::getUuid()

Overrides UuidReferenceInterface::getUuid

File

core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php, line 176

Class

EntityReferenceItemNormalizer
Converts the Drupal entity reference item object to HAL array structure.

Namespace

Drupal\hal\Normalizer

Code

public function getUuid($data) {
    if (isset($data['uuid'])) {
        $uuid = $data['uuid'];
        // The value may be a nested array like $uuid[0]['value'].
        if (is_array($uuid) && isset($uuid[0]['value'])) {
            $uuid = $uuid[0]['value'];
        }
        return $uuid;
    }
}

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