X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Flib%2FDrupal%2FCore%2FEntity%2FEntity%2FEntityViewDisplay.php;h=6783522ac9baca6262bd5f3c57a383c042c19c0d;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hp=74b15b65f4754ebff62267a668027cc4ba52c9e6;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php b/web/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php index 74b15b65f..6783522ac 100644 --- a/web/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php +++ b/web/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php @@ -8,7 +8,8 @@ use Drupal\Core\Entity\EntityDisplayPluginCollection; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\FieldableEntityInterface; use Drupal\Core\Entity\EntityDisplayBase; -use Drupal\Core\TypedData\TranslatableInterface; +use Drupal\Core\Render\Element; +use Drupal\Core\TypedData\TranslatableInterface as TranslatableDataInterface; /** * Configuration entity that contains display options for all components of a @@ -21,6 +22,9 @@ use Drupal\Core\TypedData\TranslatableInterface; * "id" = "id", * "status" = "status" * }, + * handlers = { + * "access" = "\Drupal\Core\Entity\Entity\Access\EntityViewDisplayAccessControlHandler", + * }, * config_export = { * "id", * "targetEntityType", @@ -198,7 +202,7 @@ class EntityViewDisplay extends EntityDisplayBase implements EntityViewDisplayIn 'view_mode' => $this->originalMode, // No need to prepare, defaults have been merged in setComponent(). 'prepare' => FALSE, - 'configuration' => $configuration + 'configuration' => $configuration, ]); } else { @@ -250,7 +254,7 @@ class EntityViewDisplay extends EntityDisplayBase implements EntityViewDisplayIn // those values using: // - the entity language if the entity is translatable, // - the current "content language" otherwise. - if ($entity instanceof TranslatableInterface && $entity->isTranslatable()) { + if ($entity instanceof TranslatableDataInterface && $entity->isTranslatable()) { $view_langcode = $entity->language()->getId(); } else { @@ -266,7 +270,7 @@ class EntityViewDisplay extends EntityDisplayBase implements EntityViewDisplayIn foreach ($entities as $id => $entity) { // Assign the configured weights. foreach ($this->getComponents() as $name => $options) { - if (isset($build_list[$id][$name])) { + if (isset($build_list[$id][$name]) && !Element::isEmpty($build_list[$id][$name])) { $build_list[$id][$name]['#weight'] = $options['weight']; } } @@ -298,7 +302,7 @@ class EntityViewDisplay extends EntityDisplayBase implements EntityViewDisplayIn } return [ - 'formatters' => new EntityDisplayPluginCollection($this->pluginManager, $configurations) + 'formatters' => new EntityDisplayPluginCollection($this->pluginManager, $configurations), ]; }