Consider supporting Layout Builder Overrides for other view modes

Created on 7 September 2017, over 7 years ago
Updated 29 November 2023, about 1 year ago

Problem/Motivation

#2905922: Implementation issue for Layout Builder โ†’ only supports customizing the Full/Default view mode.

For overrides, the Layout Builder UI attaches itself to the canonical route.
By default, there are no routes to view an entity in another view mode.

Additionally, for view modes like teaser, the entity is shown in a way that might have wrapping markup/styling that would not be present if displayed individually

Proposed resolution

Devise a mechanism for displaying alternate view modes.
Possibilities:

  1. Individual routes per mode, like /node/5/layout/teaser
  2. Dropdown to change the view mode being configured from /node/5/layout
  3. ?

Try to mitigate issues around lack of styling (like a listing of teasers)

Remaining tasks

Decide on an approach
Write a lot of tests

User interface changes

One way or another, yes

API changes

TBD?

Data model changes

TBD?!

โœจ Feature request
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Layout builderย  โ†’

Last updated about 20 hours ago

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States tim.plunkett Philadelphia

Live updates comments and jobs are added and updated live.
  • Blocks-Layouts

    Blocks and Layouts Initiative. See the #2811175 Add layouts to Drupal issue.

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.

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany Christian.wiedemann

    Christian.wiedemann โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany Anybody Porta Westfalica

    We just ran into this and I think it would also make a lot of sense to pass the #view_mode to the layout theme.

    Currently, that's not possible, but there are several cases, for example in layout_paragraphs, where you'd need to determine which view mode the current paragraph, which contains the layout (and thereby the layout) is rendered in!

    So that in hook_preprocess_layout(&$variables){} we can determine the view mode of the entity the current layout is rendered in:

      $variables['view_mode'];
    

    Should we have a separate issue for that, or solve it here? I think it's quite close to this issue?

Production build 0.71.5 2024