You are here

public function FileEntityNormalizer::normalize in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/hal/src/Normalizer/FileEntityNormalizer.php \Drupal\hal\Normalizer\FileEntityNormalizer::normalize()

Normalizes an object into a set of arrays/scalars.

Parameters

object $object object to normalize:

string $format format the normalization result will be encoded as:

array $context Context options for the normalizer:

Return value

array|string|bool|int|float|null

Overrides ContentEntityNormalizer::normalize

File

core/modules/hal/src/Normalizer/FileEntityNormalizer.php, line 55
Contains \Drupal\hal\Normalizer\FileEntityNormalizer.

Class

FileEntityNormalizer
Converts the Drupal entity object structure to a HAL array structure.

Namespace

Drupal\hal\Normalizer

Code

public function normalize($entity, $format = NULL, array $context = array()) {
  $data = parent::normalize($entity, $format, $context);

  // Replace the file url with a full url for the file.
  $data['uri'][0]['value'] = $this
    ->getEntityUri($entity);
  return $data;
}