Unverified Commit 7ca59215 authored by Alex Pott's avatar Alex Pott
Browse files

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
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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;
  }

+16 −0
Original line number Diff line number Diff line
@@ -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);
  }

}