Layouts are hardcoded, not embedded

Created on 30 May 2025, about 2 months ago

Problem/Motivation

This module is really useful, but it does not embed a layout per se. Rather, it hardcodes the markup found in the layout’s template into the source of the WYSIWYG field. While —again— this functionality is very helpful, the current implementation has some drawbacks.

  1. If a layout template changes, WYSIWYG editors that already use the layout are not updated.
  2. If a layout has a library attached to it (in *.layouts.yml), this library is not attached to the page when rendering the node.

I don’t have the skills to accomplish this myself (not efficiently, anyways), so I am opening this issue in hopes that someone has the time, interest, and skills to do this (assuming this improvement is actually desired by maintainers).

Steps to reproduce

Proposed resolution

I lack the expertise to know for certain how this is accomplished, but I think the solution should include the use of a custom HTML element to represent the layout (e.g. <drupal-layout>) with any necessary attributes (layout machine name, maybe some options like those discussed in 3225378 Capture all settings used by layouts Active ), another custom HTML element to represent layout regions (e.g. <drupal-layout-region>) with any necessary attributes (layout region machine name, maybe region-specific options, if that’s a thing) and the content added by the user in each region, and finally a filter that processes that custom markup, passes all of the relevant data to the layout template, and renders the layout template. This is not unlike the way a media entity is embedded, for example, via a <drupal-entity> element.

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Active

Version

2.1

Component

Code

Created by

🇺🇸United States agarzola

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

Comments & Activities

Production build 0.71.5 2024