Commit 16a6d2b9 authored by xjm's avatar xjm

Issue #3053529 by tim.plunkett, Waxwing, portulaca: Cannot enable overrides...

Issue #3053529 by tim.plunkett, Waxwing, portulaca: Cannot enable overrides for any bundle if another bundle has full view mode enabled

(cherry picked from commit c4177605)
parent ae49abed
...@@ -144,6 +144,8 @@ protected function isCanonicalMode($mode) { ...@@ -144,6 +144,8 @@ protected function isCanonicalMode($mode) {
// The default mode is valid if the canonical mode is not enabled. // The default mode is valid if the canonical mode is not enabled.
if ($mode === 'default') { if ($mode === 'default') {
$query = $this->entityTypeManager->getStorage($this->entity->getEntityTypeId())->getQuery() $query = $this->entityTypeManager->getStorage($this->entity->getEntityTypeId())->getQuery()
->condition('targetEntityType', $this->entity->getTargetEntityTypeId())
->condition('bundle', $this->entity->getTargetBundle())
->condition('status', TRUE) ->condition('status', TRUE)
->condition('mode', $canonical_mode); ->condition('mode', $canonical_mode);
return !$query->count()->execute(); return !$query->count()->execute();
......
...@@ -735,6 +735,36 @@ public function testLayoutBuilderUiFullViewMode() { ...@@ -735,6 +735,36 @@ public function testLayoutBuilderUiFullViewMode() {
$page->pressButton('Confirm'); $page->pressButton('Confirm');
} }
/**
* Ensures that one bundle doesn't interfere with another bundle.
*/
public function testFullViewModeMultipleBundles() {
$assert_session = $this->assertSession();
$page = $this->getSession()->getPage();
$this->drupalLogin($this->drupalCreateUser([
'configure any layout',
'administer node display',
]));
// Create one bundle with the full view mode enabled.
$this->createContentType(['type' => 'full_bundle']);
$this->drupalGet('admin/structure/types/manage/full_bundle/display/default');
$page->checkField('display_modes_custom[full]');
$page->pressButton('Save');
// Create another bundle without the full view mode enabled.
$this->createContentType(['type' => 'default_bundle']);
$this->drupalGet('admin/structure/types/manage/default_bundle/display/default');
// Enable Layout Builder for defaults and overrides.
$page->checkField('layout[enabled]');
$page->pressButton('Save');
$page->checkField('layout[allow_custom]');
$page->pressButton('Save');
$assert_session->checkboxChecked('layout[allow_custom]');
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
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