3 namespace Drupal\serialization\Normalizer;
5 use Drupal\Core\TypedData\TypedDataInternalPropertiesHelper;
8 * Normalizes/denormalizes Drupal content entities into an array structure.
10 class ContentEntityNormalizer extends EntityNormalizer {
15 protected $supportedInterfaceOrClass = ['Drupal\Core\Entity\ContentEntityInterface'];
20 public function normalize($entity, $format = NULL, array $context = []) {
26 /** @var \Drupal\Core\Entity\Entity $entity */
27 foreach (TypedDataInternalPropertiesHelper::getNonInternalProperties($entity->getTypedData()) as $name => $field_items) {
28 if ($field_items->access('view', $context['account'])) {
29 $attributes[$name] = $this->serializer->normalize($field_items, $format, $context);