public function ContentEntityNormalizer::normalize in Zircon Profile 8
Same name in this branch
- 8 core/modules/hal/src/Normalizer/ContentEntityNormalizer.php \Drupal\hal\Normalizer\ContentEntityNormalizer::normalize()
- 8 core/modules/serialization/src/Normalizer/ContentEntityNormalizer.php \Drupal\serialization\Normalizer\ContentEntityNormalizer::normalize()
Same name and namespace in other branches
- 8.0 core/modules/serialization/src/Normalizer/ContentEntityNormalizer.php \Drupal\serialization\Normalizer\ContentEntityNormalizer::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 ComplexDataNormalizer::normalize
File
- core/
modules/ serialization/ src/ Normalizer/ ContentEntityNormalizer.php, line 25 - Contains \Drupal\serialization\Normalizer\ContentEntityNormalizer.
Class
- ContentEntityNormalizer
- Normalizes/denormalizes Drupal content entities into an array structure.
Namespace
Drupal\serialization\NormalizerCode
public function normalize($object, $format = NULL, array $context = array()) {
$context += array(
'account' => NULL,
);
$attributes = [];
foreach ($object as $name => $field) {
if ($field
->access('view', $context['account'])) {
$attributes[$name] = $this->serializer
->normalize($field, $format, $context);
}
}
return $attributes;
}