X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Flib%2FDrupal%2FCore%2FEntity%2FEntityDisplayBase.php;h=dbda544ef050545719037f638285dd161d9e8492;hb=refs%2Fheads%2Fd864;hp=2a3945bff89662329341653e411914f28e0fcb63;hpb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;p=yaffs-website diff --git a/web/core/lib/Drupal/Core/Entity/EntityDisplayBase.php b/web/core/lib/Drupal/Core/Entity/EntityDisplayBase.php index 2a3945bff..dbda544ef 100644 --- a/web/core/lib/Drupal/Core/Entity/EntityDisplayBase.php +++ b/web/core/lib/Drupal/Core/Entity/EntityDisplayBase.php @@ -163,12 +163,12 @@ abstract class EntityDisplayBase extends ConfigEntityBase implements EntityDispl if (!isset($this->content[$name]) && !isset($this->hidden[$name])) { // Extra fields are visible by default unless they explicitly say so. if (!isset($definition['visible']) || $definition['visible'] == TRUE) { - $this->content[$name] = [ - 'weight' => $definition['weight'] - ]; + $this->setComponent($name, [ + 'weight' => $definition['weight'], + ]); } else { - $this->hidden[$name] = TRUE; + $this->removeComponent($name); } } // Ensure extra fields have a 'region'. @@ -190,11 +190,11 @@ abstract class EntityDisplayBase extends ConfigEntityBase implements EntityDispl } if (!empty($options['region']) && $options['region'] === 'hidden') { - $this->hidden[$name] = TRUE; + $this->removeComponent($name); } elseif ($options) { $options += ['region' => $default_region]; - $this->content[$name] = $this->pluginManager->prepareConfiguration($definition->getType(), $options); + $this->setComponent($name, $options); } // Note: (base) fields that do not specify display options are not // tracked in the display at all, in order to avoid cluttering the @@ -250,7 +250,7 @@ abstract class EntityDisplayBase extends ConfigEntityBase implements EntityDispl /** * {@inheritdoc} */ - public function preSave(EntityStorageInterface $storage, $update = TRUE) { + public function preSave(EntityStorageInterface $storage) { // Ensure that a region is set on each component. foreach ($this->getComponents() as $name => $component) { $this->handleHiddenType($name, $component); @@ -263,7 +263,7 @@ abstract class EntityDisplayBase extends ConfigEntityBase implements EntityDispl ksort($this->content); ksort($this->hidden); - parent::preSave($storage, $update); + parent::preSave($storage); } /**