class ContentEntityNormalizer in Zircon Profile 8
Same name in this branch
- 8 core/modules/hal/src/Normalizer/ContentEntityNormalizer.php \Drupal\hal\Normalizer\ContentEntityNormalizer
- 8 core/modules/serialization/src/Normalizer/ContentEntityNormalizer.php \Drupal\serialization\Normalizer\ContentEntityNormalizer
Same name and namespace in other branches
- 8.0 core/modules/serialization/src/Normalizer/ContentEntityNormalizer.php \Drupal\serialization\Normalizer\ContentEntityNormalizer
Normalizes/denormalizes Drupal content entities into an array structure.
Hierarchy
- class \Symfony\Component\Serializer\Normalizer\SerializerAwareNormalizer implements SerializerAwareInterface
- class \Drupal\serialization\Normalizer\NormalizerBase implements NormalizerInterface
- class \Drupal\serialization\Normalizer\ComplexDataNormalizer
- class \Drupal\serialization\Normalizer\EntityNormalizer implements DenormalizerInterface
- class \Drupal\serialization\Normalizer\ContentEntityNormalizer
- class \Drupal\serialization\Normalizer\EntityNormalizer implements DenormalizerInterface
- class \Drupal\serialization\Normalizer\ComplexDataNormalizer
- class \Drupal\serialization\Normalizer\NormalizerBase implements NormalizerInterface
Expanded class hierarchy of ContentEntityNormalizer
1 file declares its use of ContentEntityNormalizer
- ContentEntityNormalizerTest.php in core/
modules/ serialization/ tests/ src/ Unit/ Normalizer/ ContentEntityNormalizerTest.php - Contains \Drupal\Tests\serialization\Unit\Normalizer\ContentEntityNormalizerTest.
1 string reference to 'ContentEntityNormalizer'
- serialization.services.yml in core/
modules/ serialization/ serialization.services.yml - core/modules/serialization/serialization.services.yml
1 service uses ContentEntityNormalizer
- serializer.normalizer.content_entity in core/
modules/ serialization/ serialization.services.yml - Drupal\serialization\Normalizer\ContentEntityNormalizer
File
- core/
modules/ serialization/ src/ Normalizer/ ContentEntityNormalizer.php, line 13 - Contains \Drupal\serialization\Normalizer\ContentEntityNormalizer.
Namespace
Drupal\serialization\NormalizerView source
class ContentEntityNormalizer extends EntityNormalizer {
/**
* The interface or class that this Normalizer supports.
*
* @var array
*/
protected $supportedInterfaceOrClass = [
'Drupal\\Core\\Entity\\ContentEntityInterface',
];
/**
* {@inheritdoc}
*/
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;
}
}