Change Layout into first-order configuration entity, allowing all layouts to be reusable and exportable configuration entities.

Created on 11 May 2019, over 5 years ago
Updated 10 April 2024, 5 months ago

This issue the result of conversations at the Drupaldelphia2019 Layout BoF session.

Problem/Motivation

There are a number of issues that may be addressable (comparatively easily?) with a change in the Layout architecture:

  1. Unable to clone overridden layouts
  2. Layouts on Content Types treated as Configuration, but Layouts on Nodes treated as Content
  3. Unable to reuse Layouts across Content Types
  4. Unable to list Layouts used across system

Proposed resolution

Instead of making Layouts settings that are attached to Content Types or Nodes,

  1. make Layouts a "first level" config entity
  2. provide an /admin/structure/layouts administrative interface to define layouts
  3. for each Layout, provide a way to define the Context(s) that use that layout (eg: Context="All [Article, Basic] content types and NID [5,10]")
  4. Define a Weight for each Layout so if what is being rendered's context matches multiple layouts we know which one to select.
  5. Context selection could be done similar to the core Block module's context options (Content Type, Pages, Roles) or via the Context module.

This would allow Layouts to be centrally defined and managed, provide for easy reuse of Layouts across the system by any desired context, and all Layouts would become exportable configuration entities instead of being attached to individual nodes, while still having even more flexibility than we do now.

The UI for defining content type layouts (eg: Context="ContentType=Article") and overriding node Layouts could remain as-is, but instead of attaching the Layout info to the node, it would create a new Layout configuration entity with (eg: Context="NID=1234").

Having an Add Layout option on the /admin/structure/layouts page would pair well with #3054056: When editing the layout for a content view mode, allow picking a specific node to use as the preview β†’ for showing placeholder data. Some UI magic could be done to filter the available blocks down to whatever entity is being previewed to reduce the amount of fields to pick from.

Remaining tasks

  1. Define new Context configuration entities
  2. Create Layout Listing admin page - could display Layout Name, Layout Description, Machine Name, Context fields, Links to Edit Layout, Links to Content (for node overrides)
  3. Create Add Layout admin page (or else only use the existing Content Type and Override layouts UI)
  4. Update Umami layouts to use new system

User interface changes

  1. Add new admin screens as described above.
  2. Existing interface would be visually unchanged.

API changes

TBD

Data model changes

TBD

Release notes snippet

Change Layout into first-order configuration entity, allowing all layouts to be reusable and exportable configuration entities.

✨ Feature request
Status

Closed: works as designed

Version

11.0 πŸ”₯

Component
Layout builderΒ  β†’

Last updated less than a minute ago

Created by

πŸ‡ΊπŸ‡ΈUnited States diamondsea

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡ΏNew Zealand DanielVeza Brisbane, AU

    I agree with @mikelutz in #3. That remains accurate today so I am also -1 on this idea. This would be a lot of work, BC/updates to existing sites would be tricky and I don't believe the system would be better because of it.

    @tim.plunkett pointed out a contrib module that may help resolve some of the pain points outlined in this issue, so this may belong something that remains in the contrib space rather than core.

    Postponing so that others can provide their thoughts

  • Status changed to Closed: works as designed 5 months ago
  • πŸ‡ΊπŸ‡ΈUnited States mikelutz Michigan, USA

    I think 5 years was enough time for others to provide their thoughts. Layout Builder has matured in core, and I don't see us making these types of deep architectural changes at this point.

Production build 0.71.5 2024