diff --git a/core/modules/entity/lib/Drupal/entity/Plugin/DisplayComponent/ExtraFieldDisplayComponentHandler.php b/core/modules/entity/lib/Drupal/entity/Plugin/DisplayComponent/ExtraFieldDisplayComponentHandler.php index bda2727..0597003 100644 --- a/core/modules/entity/lib/Drupal/entity/Plugin/DisplayComponent/ExtraFieldDisplayComponentHandler.php +++ b/core/modules/entity/lib/Drupal/entity/Plugin/DisplayComponent/ExtraFieldDisplayComponentHandler.php @@ -86,7 +86,7 @@ public function prepareDisplayComponents(array &$components) { /** * {@inheritdoc} */ - public function massageOut($name, array $options = array()) { + public function massageOut($name, array $options = null) { // We always store 'extra fields', whether they are visible or hidden. Only // return an options array for visible components. if (!isset($options['visible']) || $options['visible'] == TRUE) { @@ -98,12 +98,12 @@ public function massageOut($name, array $options = array()) { /** * {@inheritdoc} */ - public function massageIn($name, array $options = array()) { + public function massageIn($name, array $options = null) { // 'Extra fields' are exposed in hooks and can appear at any given time. // Therefore we store extra fields that are explicitly being hidden, so // that we can differentiate with those that are simply not configured // yet. - if (isset($options['visible'])) { + if (is_null($options)) { $options['visible'] = FALSE; } else { diff --git a/core/modules/entity/lib/Drupal/entity/Plugin/Type/DisplayComponentHandlerBase.php b/core/modules/entity/lib/Drupal/entity/Plugin/Type/DisplayComponentHandlerBase.php index a703ba4..2790ab3 100644 --- a/core/modules/entity/lib/Drupal/entity/Plugin/Type/DisplayComponentHandlerBase.php +++ b/core/modules/entity/lib/Drupal/entity/Plugin/Type/DisplayComponentHandlerBase.php @@ -45,7 +45,7 @@ public function prepareDisplayComponents(array &$components) { * @param array $options * @return array */ - public function massageOut($name, array $options = array()) { + public function massageOut($name, array $options = null) { return $options; } @@ -56,7 +56,7 @@ public function massageOut($name, array $options = array()) { * @param array $options * @return array */ - public function massageIn($name, array $options = array()) { + public function massageIn($name, array $options = null) { return $options; } @@ -66,7 +66,7 @@ public function massageIn($name, array $options = array()) { * @param string $name * @param array $options */ - public function getRenderer($name, array $options = array()) { + public function getRenderer($name, array $options = null) { } } diff --git a/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php b/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php index 235b780..86c63ff 100644 --- a/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php +++ b/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php @@ -52,7 +52,7 @@ public function testEntityDisplayCRUD() { // Check that arbitrary options are correctly stored. $expected['component_3'] = array('weight' => 10, 'foo' => 'bar'); - $display->setComponent('component_3', $expected['component_3']); + $display->setComponent('component_3', 'default', $expected['component_3']); $this->assertEqual($display->getComponent('component_3'), $expected['component_3']); // Check that the display can be properly saved and read back. diff --git a/core/modules/field/lib/Drupal/field/Plugin/DisplayComponent/FieldDisplayComponentHandler.php b/core/modules/field/lib/Drupal/field/Plugin/DisplayComponent/FieldDisplayComponentHandler.php index fa32b38..217e12a 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/DisplayComponent/FieldDisplayComponentHandler.php +++ b/core/modules/field/lib/Drupal/field/Plugin/DisplayComponent/FieldDisplayComponentHandler.php @@ -87,7 +87,7 @@ public function massageIn($name, array $options = array()) { $field = $this->fieldInfo->getField($this->context['entity_type'], $name); if (!$field) { // The field in process of removal from display. - return; + return $options; } if ($this->context['display_context'] == 'display') { return $this->formatterPluginManager->prepareConfiguration($field->getFieldType(), $options);