Commit 7ca59215 authored by alexpott's avatar alexpott

Issue #3019824 by nord102, tim.plunkett: Layout Builder's...

Issue #3019824 by nord102, tim.plunkett: Layout Builder's isOverridable()/setOverridable() do not respect the result of isLayoutBuilderEnabled()
parent 518e8fff
......@@ -61,6 +61,10 @@ public function isOverridable() {
*/
public function setOverridable($overridable = TRUE) {
$this->setThirdPartySetting('layout_builder', 'allow_custom', $overridable);
// Enable Layout Builder if it's not already enabled and overriding.
if ($overridable && !$this->isLayoutBuilderEnabled()) {
$this->enableLayoutBuilder();
}
return $this;
}
......
......@@ -61,4 +61,20 @@ public function testGetRuntimeSections() {
$this->assertEquals($this->sectionStorage->getSections(), $result);
}
/**
* Tests that setting overridable enables Layout Builder only when set to TRUE.
*/
public function testSetOverridable() {
// Disable Layout Builder.
$this->sectionStorage->disableLayoutBuilder();
// Set Overridable to TRUE and ensure Layout Builder is enabled.
$this->sectionStorage->setOverridable();
$this->assertEquals($this->sectionStorage->isLayoutBuilderEnabled(), TRUE);
// Ensure Layout Builder is still enabled after setting Overridable to FALSE.
$this->sectionStorage->setOverridable(FALSE);
$this->assertEquals($this->sectionStorage->isLayoutBuilderEnabled(), TRUE);
}
}
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