Background

Layout builder relies on the Layout Discovery module.

This provides a plugin system that provides metadata about layout plugins.

Each layout plugin comprises sections and a theme hook (Twig template).

The Twig template contains the markup and arrangement of the sections in the layout.

We can use the metadata from the Layout plugin definition as important metadata for the decoupled approach, but we still need a React version of the Twig template.

Proposed resolution

Create a simple layout registry and registration process for layout plugins. Create an MVP of some common layout plugins:

  • One column
  • Two column
  • Grid layout

Out of scope but for future consideration:

  • Attempt to use the AST-generated Twig APIs to autogenerate React components that provide the markup for a layout plugin.
  • Write a Symfony/console command that can take the ID of a layout plugin and generate an equivalent React component.
  • Bundle this as a part of a new experimental module.

Comments

griffynh created an issue. See original summary.

griffynh’s picture

Issue summary: View changes
griffynh’s picture

Issue summary: View changes
griffynh’s picture

larowlan’s picture

Status: Active » Fixed

Layouts need to be implemented like so https://project.pages.drupalcode.org/decoupled_lb/?path=/docs/developmen...

Plugins can be associated with a component by adding an entry to the plugin definition with keys 'componentPath' which points to the transpiled JS file and an optional 'library' key if any CSS needs to also be added to the page.

Example https://git.drupalcode.org/project/decoupled_lb_api/-/blob/1.x/decoupled...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.