Updated to Drupal 8.6.4, which is PHP 7.3 friendly. Also updated HTMLaw library....
[yaffs-website] / web / core / modules / serialization / src / Normalizer / ContentEntityNormalizer.php
index f1ca82d54972e7eb654cd40079942c6dc9da112f..85635a92a20e5259d8be816701d914dea2d23f7e 100644 (file)
@@ -2,6 +2,8 @@
 
 namespace Drupal\serialization\Normalizer;
 
+use Drupal\Core\TypedData\TypedDataInternalPropertiesHelper;
+
 /**
  * Normalizes/denormalizes Drupal content entities into an array structure.
  */
@@ -15,15 +17,16 @@ class ContentEntityNormalizer extends EntityNormalizer {
   /**
    * {@inheritdoc}
    */
-  public function normalize($object, $format = NULL, array $context = []) {
+  public function normalize($entity, $format = NULL, array $context = []) {
     $context += [
       'account' => NULL,
     ];
 
     $attributes = [];
-    foreach ($object as $name => $field) {
-      if ($field->access('view', $context['account'])) {
-        $attributes[$name] = $this->serializer->normalize($field, $format, $context);
+    /** @var \Drupal\Core\Entity\Entity $entity */
+    foreach (TypedDataInternalPropertiesHelper::getNonInternalProperties($entity->getTypedData()) as $name => $field_items) {
+      if ($field_items->access('view', $context['account'])) {
+        $attributes[$name] = $this->serializer->normalize($field_items, $format, $context);
       }
     }