diff --git a/core/modules/node/node.install b/core/modules/node/node.install index f1405bf..1b7f6c0 100644 --- a/core/modules/node/node.install +++ b/core/modules/node/node.install @@ -265,12 +265,12 @@ function node_update_8302() { // Assign status settings for each 'node' target entity types with 'default' // form mode. foreach ($form_displays as $id => $form_display) { - $form_display->setComponent('status', array( + $form_display->setComponent('status', [ 'type' => 'boolean_checkbox', - 'settings' => array( + 'settings' => [ 'display_label' => TRUE, - ), - )) + ], + ]) ->save(); } } diff --git a/core/modules/node/src/Tests/Update/NodeUpdateTest.php b/core/modules/node/src/Tests/Update/NodeUpdateTest.php index b8b30be..0111606 100644 --- a/core/modules/node/src/Tests/Update/NodeUpdateTest.php +++ b/core/modules/node/src/Tests/Update/NodeUpdateTest.php @@ -2,6 +2,7 @@ namespace Drupal\node\Tests\Update; +use Drupal\Core\Entity\Entity\EntityFormDisplay; use Drupal\system\Tests\Update\UpdatePathTestBase; /** @@ -38,4 +39,29 @@ public function testPublishedEntityKey() { $this->assertEqual('status', $entity_type->getKey('published')); } + /** + * Tests that the node entity form has the status checkbox. + * + * @see node_update_8302() + */ + public function testStatusCheckbox() { + // Run updates. + $this->runUpdates(); + + $query = \Drupal::entityQuery('entity_form_display') + ->condition('targetEntityType', 'node'); + $ids = $query->execute(); + $form_displays = EntityFormDisplay::loadMultiple($ids); + + /** + * @var string $id + * @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display + */ + foreach ($form_displays as $id => $form_display) { + $component = $form_display->getComponent('status'); + $this->assertEqual('boolean_checkbox', $component['type']); + $this->assertEqual(['display_label' => TRUE], $component['settings']); + } + } + }