Unverified Commit e3c750b0 authored by alexpott's avatar alexpott

Issue #2970801 by tedbow, tim.plunkett, likin, sugaroverflow: If you add block...

Issue #2970801 by tedbow, tim.plunkett, likin, sugaroverflow: If you add block then try to Revert the layout it doesn't revert
parent a2284209
......@@ -47,9 +47,12 @@ protected function setSections(array $sections) {
/**
* {@inheritdoc}
*/
public function __wakeup() {
public function getEntity() {
$entity = parent::getEntity();
// Ensure the entity is updated with the latest value.
$this->getEntity()->set($this->getName(), $this->getValue());
$entity->set($this->getName(), $this->getValue());
return $entity;
}
}
......@@ -103,10 +103,6 @@ public function buildForm(array $form, FormStateInterface $form_state, SectionSt
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
// Ensure the section storage is loaded from the database.
// @todo Remove after https://www.drupal.org/node/2970801.
$this->sectionStorage = \Drupal::service('plugin.manager.layout_builder.section_storage')->loadFromStorageId($this->sectionStorage->getStorageType(), $this->sectionStorage->getStorageId());
// Remove all sections.
while ($this->sectionStorage->count()) {
$this->sectionStorage->removeSection(0);
......
......@@ -191,11 +191,21 @@ public function testLayoutBuilderUi() {
// Reverting the override returns it to the defaults.
$this->clickLink('Layout');
$assert_session->linkExists('Add Block');
$this->clickLink('Add Block');
$assert_session->linkExists('ID');
$this->clickLink('ID');
$page->pressButton('Add Block');
// The title field is present.
$assert_session->elementExists('css', '.field--name-nid');
$assert_session->pageTextContains('ID');
$assert_session->pageTextContains('1');
$assert_session->linkExists('Revert to defaults');
$this->clickLink('Revert to defaults');
$page->pressButton('Revert');
$assert_session->pageTextContains('The layout has been reverted back to defaults.');
$assert_session->elementExists('css', '.field--name-title');
$assert_session->elementNotExists('css', '.field--name-nid');
$assert_session->pageTextContains('The first node body');
$assert_session->pageTextContains('Powered by Drupal');
$assert_session->pageTextContains('Placeholder for the "Extra label" field');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment