Allow for more granuilar theme hooks for layout builder

Created on 1 May 2024, 8 months ago

Problem/Motivation

Using the default section and columns in layout builder, I would like to be able to be able to have additional theme hooks for twig by content type. This would allow me to wrap a class (such as a div) around a column (or group of columns within a section) without having to create a global class or write something custom.

Steps to reproduce

  • Create a section within layout builder and apply a columns to the layout.
  • Turn on twig debug in /admin/config/development/settings
  • Navigate to your page and inspect
  • View File Name Suggestions
      FILE NAME SUGGESTIONS:
       x layout--twocol-section.html.twig
       x layout--twocol-section.html.twig
       * layout.html.twig

Proposed resolution

Allow layout builder theme hooks to render at a content type level of granularity. EG

  FILE NAME SUGGESTIONS:
   x layout--page--twocol-section.html.twig
   x layout-node-[number]-page--twocol-section.html.twig
   x layout--twocol-section.html.twig
   x layout--twocol-section.html.twig
   * layout.html.twig

BEGIN OUTPUT from 'themes/custom/my-theme/templates/layout/layout--page--twocol-section.html.twig'

I don't think it's necessary to go down to a node ID for columns, but since layout builder allows "Allow each content item to have its layout customized." it should be accounted for in the road map, if accepted.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

✨ Feature request
Status

Closed: duplicate

Version

11.0 πŸ”₯

Component
Layout builderΒ  β†’

Last updated 4 days ago

Created by

πŸ‡ΊπŸ‡ΈUnited States laura.gates

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

Comments & Activities

Production build 0.71.5 2024