diff -u b/core/lib/Drupal/Core/Entity/DisplayComponentHandlerBase.php b/core/lib/Drupal/Core/Entity/DisplayComponentHandlerBase.php --- b/core/lib/Drupal/Core/Entity/DisplayComponentHandlerBase.php +++ b/core/lib/Drupal/Core/Entity/DisplayComponentHandlerBase.php @@ -39,14 +39,14 @@ /** * {@inheritdoc} */ - public function massageIn($name, array $options) { + public function preSave($name, array $options) { return $options; } /** * {@inheritdoc} */ - public function massageOut($properties) { + public function postLoad($properties) { return $properties; } diff -u b/core/lib/Drupal/Core/Entity/DisplayComponentHandlerInterface.php b/core/lib/Drupal/Core/Entity/DisplayComponentHandlerInterface.php --- b/core/lib/Drupal/Core/Entity/DisplayComponentHandlerInterface.php +++ b/core/lib/Drupal/Core/Entity/DisplayComponentHandlerInterface.php @@ -29,7 +29,20 @@ * @return array * Massaged component options. */ - public function massageIn($name, array $options); + public function preSave($name, array $options); + + /** + * Prepares the display options after they are retrieved from the storage. + * + * @param array $properties + * The entity display properties. + * + * @return array + * An associative array of the display components with following keys: + * - content: Configured components to render. + * - hidden: Configured components to hide from render. + */ + public function postLoad(array $properties); /** * Sets the context for the rendering component. @@ -69,15 +82,2 @@ - /** - * Prepares the display options after they are retrieved from the storage. - * - * @param array $properties - * The entity display properties. - * - * @return array - * An associative array of the display components with following keys: - * - content: Configured components to render. - * - hidden: Configured components to hide from render. - */ - public function massageOut(array $properties); - } diff -u b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php --- b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php +++ b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php @@ -324,7 +324,7 @@ } $handlers = $this->handlerManager->getDefinitions(); foreach (array_keys($handlers) as $type) { - $properties = $this->getComponentHandler($type)->massageOut($properties); + $properties = $this->getComponentHandler($type)->postLoad($properties); } return $properties; @@ -365,7 +365,7 @@ // Massage in some values. if ($handler = $this->getComponentHandlerByElementName($name)) { - $options = $handler->massageIn($name, $options); + $options = $handler->preSave($name, $options); } // Ensure we always have an empty settings and array. diff -u b/core/lib/Drupal/Core/Entity/Plugin/DisplayComponent/FieldDisplayComponentHandler.php b/core/lib/Drupal/Core/Entity/Plugin/DisplayComponent/FieldDisplayComponentHandler.php --- b/core/lib/Drupal/Core/Entity/Plugin/DisplayComponent/FieldDisplayComponentHandler.php +++ b/core/lib/Drupal/Core/Entity/Plugin/DisplayComponent/FieldDisplayComponentHandler.php @@ -77,7 +77,7 @@ /** * {@inheritdoc} */ - public function massageIn($name, array $options) { + public function preSave($name, array $options) { $field_definition = $this->getFieldDefinition($name); if (!isset($field_definition)) { // The field in process of removal from display. @@ -94,7 +94,7 @@ /** * {@inheritdoc} */ - public function massageOut($properties) { + public function postLoad($properties) { // Do not store options for fields whose display is not set to be // configurable. foreach ($this->getDisplayableFields() as $field_name => $definition) { diff -u b/core/modules/field/tests/src/Unit/Plugin/DisplayComponent/FieldDisplayComponentHandlerTest.php b/core/modules/field/tests/src/Unit/Plugin/DisplayComponent/FieldDisplayComponentHandlerTest.php --- b/core/modules/field/tests/src/Unit/Plugin/DisplayComponent/FieldDisplayComponentHandlerTest.php +++ b/core/modules/field/tests/src/Unit/Plugin/DisplayComponent/FieldDisplayComponentHandlerTest.php @@ -108,13 +108,13 @@ } /** - * Tests MassageIn. + * Tests preSave(). * - * @covers ::massageIn() + * @covers ::preSave() * - * @dataProvider providerTestMassageIn + * @dataProvider providerTestPreSave */ - public function testMassageIn($field_name, $display_context, $expected) { + public function testPreSave($field_name, $display_context, $expected) { $this->formatterPluginManager->expects($this->any()) ->method('prepareConfiguration') ->willReturn('formatter configuration'); @@ -128,16 +128,16 @@ 'display_context' => $display_context, ]); - $testMethod = new \ReflectionMethod(FieldDisplayComponentHandler::class, 'massageIn'); + $testMethod = new \ReflectionMethod(FieldDisplayComponentHandler::class, 'preSave'); $testMethod->setAccessible(TRUE); $actual = $testMethod->invokeArgs($this->handler, [$field_name, []]); $this->assertEquals($expected, $actual); } /** - * Provides data for testGetDisplayableField(). + * Provides data for testPreSave(). */ - public function providerTestMassageIn() { + public function providerTestPreSave() { return [ 'no field definition' => [ 'not_exist', @@ -159,13 +159,13 @@ } /** - * Tests MassageOut. + * Tests postLoad(). * - * @covers ::massageOut() + * @covers ::postLoad() * - * @dataProvider providerTestMassageOut + * @dataProvider providerTestPostLoad */ - public function testMassageOut($properties, $display_context, $expected) { + public function testPostLoad($properties, $display_context, $expected) { $properties = [ 'content' => [ 'title' => 'foo', @@ -187,16 +187,16 @@ 'display_context' => $display_context, ]); - $testMethod = new \ReflectionMethod(FieldDisplayComponentHandler::class, 'massageOut'); + $testMethod = new \ReflectionMethod(FieldDisplayComponentHandler::class, 'postLoad'); $testMethod->setAccessible(TRUE); $actual = $testMethod->invokeArgs($this->handler, [$properties]); $this->assertEquals($expected, $actual); } /** - * Provides data for testGetDisplayableField(). + * Provides data for testPostLoad(). */ - public function providerTestMassageOut() { + public function providerTestPostLoad() { $properties = [ 'content' => [ 'title' => 'foo',