public function EntityReferenceItemNormalizer::getUuid in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php \Drupal\hal\Normalizer\EntityReferenceItemNormalizer::getUuid()
Get the uuid from the data array.
Parameters
array $data: The data, as was passed into the Normalizer.
Return value
string A UUID.
Overrides UuidReferenceInterface::getUuid
File
- core/modules/ hal/ src/ Normalizer/ EntityReferenceItemNormalizer.php, line 116 
- Contains \Drupal\hal\Normalizer\EntityReferenceItemNormalizer.
Class
- EntityReferenceItemNormalizer
- Converts the Drupal entity reference item object to HAL array structure.
Namespace
Drupal\hal\NormalizerCode
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;
  }
}