Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294689

Layout Builder's isOverridable()/setOverridable() do not respect the result of isLayoutBuilderEnabled()

$
0
0

Problem/Motivation

\Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay has methods supporting the two checkboxes on "Manage display":
"Use Layout Builder": isLayoutBuilderEnabled()/enableLayoutBuilder()/disableLayoutBuilder()
"Allow each @entity_type to have its layout customized.": isOverridable()/setOverridable($overridable = TRUE)

(Ignore the strangeness of one checkbox having 3 methods and the other having 2 with one taking a bool)

In the UI, the "customized" (overridable) checkbox cannot be checked unless Layout Builder is enabled.
However, that is not enforced on the API level.

Proposed resolution

There are multiple options:

  1. Throw an exception if isLayoutBuilderEnabled() is FALSE when setOverridable() is called with TRUE or if disableLayoutBuilder() is called when isOverridable() is TRUE
  2. Rewrite setOverridable() so that when it is called with TRUE enableLayoutBuilder() is called, and rewrite disableLayoutBuilder() so that when it is called setOverridable(FALSE) is called

#1 is more explicit but may be considered an API break

Remaining tasks

Write tests
Decide on an solution

User interface changes

N/A, this already is enforced in the UI and has test coverage

API changes

Maybe?

Data model changes

N/A

Release notes snippet

N/A


Viewing all articles
Browse latest Browse all 294689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>