diff --git a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php index 04ccd0b..a138c3b 100644 --- a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php +++ b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php @@ -22,6 +22,8 @@ use ThirdPartySettingsTrait; + const CUSTOM_MODE = '_custom'; + /** * Unique ID for the config entity. * @@ -55,7 +57,7 @@ * * @var string */ - public $mode; + public $mode = self::CUSTOM_MODE; /** * Whether this display is enabled or not. If the entity (form) display @@ -112,7 +114,7 @@ * {@inheritdoc} */ public function __construct(array $values, $entity_type) { - if (!isset($values['targetEntityType']) || !isset($values['bundle']) || !isset($values['mode'])) { + if (!isset($values['targetEntityType']) || !isset($values['bundle'])) { throw new \InvalidArgumentException('Missing required properties for an EntityDisplay entity.'); } @@ -345,8 +347,9 @@ protected function getFieldDefinitions() { if (!isset($this->fieldDefinitions)) { $definitions = \Drupal::entityManager()->getFieldDefinitions($this->targetEntityType, $this->bundle); - // @fixme Yeah sounds sensible but it blocks views from rendering a field. - // $this->fieldDefinitions = array_filter($definitions, array($this, 'fieldHasDisplayOptions')); + if ($this->mode !== static::CUSTOM_MODE) { + $definitions = array_filter($definitions, array($this, 'fieldHasDisplayOptions')); + } $this->fieldDefinitions = $definitions; } diff --git a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php index a6688f4..420e787 100644 --- a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php +++ b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php @@ -475,7 +475,6 @@ protected function getSingleFieldDisplay($entity, $field_name, $display_options) $this->singleFieldDisplays[$key] = EntityViewDisplay::create(array( 'targetEntityType' => $entity_type_id, 'bundle' => $bundle, - 'mode' => '_custom', 'status' => TRUE, ))->setComponent($field_name, $display_options); }