Unverified Commit 7387e2ab authored by alexpott's avatar alexpott

Issue #2952967 by tim.plunkett, sarahjean: When allowing content items to have...

Issue #2952967 by tim.plunkett, sarahjean: When allowing content items to have customized layouts, clicking 'Layout' on full view of a node takes you to the configuration for the 'default' view mode
parent 93bf4cb5
......@@ -187,7 +187,9 @@ protected function getEntityTypes() {
* {@inheritdoc}
*/
public function getDefaultSectionStorage() {
return LayoutBuilderEntityViewDisplay::collectRenderDisplay($this->getEntity(), 'default');
// @todo Expand to work for all view modes in
// https://www.drupal.org/node/2907413.
return LayoutBuilderEntityViewDisplay::collectRenderDisplay($this->getEntity(), 'full');
}
/**
......
......@@ -256,4 +256,67 @@ public function testPluginDependencies() {
$assert_session->elementNotExists('css', '.block.menu--mymenu');
}
/**
* Tests the interaction between full and default view modes.
*
* @see \Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage::getDefaultSectionStorage()
*/
public function testLayoutBuilderUiFullViewMode() {
$assert_session = $this->assertSession();
$page = $this->getSession()->getPage();
$this->drupalLogin($this->drupalCreateUser([
'configure any layout',
'administer node display',
'administer node fields',
]));
$field_ui_prefix = 'admin/structure/types/manage/bundle_with_section_field';
// Allow overrides for the layout.
$this->drupalPostForm("$field_ui_prefix/display/default", ['layout[allow_custom]' => TRUE], 'Save');
// Customize the default view mode.
$this->drupalGet("$field_ui_prefix/display-layout/default");
$this->clickLink('Add Block');
$this->clickLink('Powered by Drupal');
$page->fillField('settings[label]', 'This is the default view mode');
$page->checkField('settings[label_display]');
$page->pressButton('Add Block');
$assert_session->pageTextContains('This is the default view mode');
$this->clickLink('Save Layout');
// The default view mode is used for both the node display and layout UI.
$this->drupalGet('node/1');
$assert_session->pageTextContains('This is the default view mode');
$this->drupalGet('node/1/layout');
$assert_session->pageTextContains('This is the default view mode');
$this->clickLink('Cancel Layout');
// Enable the full view mode and customize it.
$this->drupalPostForm("$field_ui_prefix/display/default", ['display_modes_custom[full]' => TRUE], 'Save');
$this->drupalGet("$field_ui_prefix/display-layout/full");
$this->clickLink('Add Block');
$this->clickLink('Powered by Drupal');
$page->fillField('settings[label]', 'This is the full view mode');
$page->checkField('settings[label_display]');
$page->pressButton('Add Block');
$assert_session->pageTextContains('This is the full view mode');
$this->clickLink('Save Layout');
// The full view mode is now used for both the node display and layout UI.
$this->drupalGet('node/1');
$assert_session->pageTextContains('This is the full view mode');
$this->drupalGet('node/1/layout');
$assert_session->pageTextContains('This is the full view mode');
$this->clickLink('Cancel Layout');
// Disable the full view mode, the default should be used again.
$this->drupalPostForm("$field_ui_prefix/display/default", ['display_modes_custom[full]' => FALSE], 'Save');
$this->drupalGet('node/1');
$assert_session->pageTextContains('This is the default view mode');
$this->drupalGet('node/1/layout');
$assert_session->pageTextContains('This is the default view mode');
$this->clickLink('Cancel Layout');
}
}
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