![]() ![]() The Menu Item Extras module has been used in Drupal 8 for a while to implement mega menus via additional fields. For example, you can add an "icon" image field that will be displayed next to the menu link. This module allows you to add fields to a menu entity along with form and display view modes. If Layout Builder works with any fieldable entity, how can we make a Menu Item entity fieldable? The answer is the menu_item_extras contrib module. Specifically, any entity that is "fieldable" is supported. While the use of Layout Builder is focused on Nodes (such as Landing Pages), the Layout Builder architecture actually works with any entity type that supports the Section Storage. If node-specific overrides are enabled for the bundle, the overriding list of blocks in the section are stored within a layout_builder_layout field added to the node. The default layout for a content type is stored in the third_party_settings for the specific view mode configuration. Layout Builder uses a Section Storage plugin to determine how the list of block uuids referenced in a layout section are stored. When an inline block is edited, a new revision of the block is created and a new revision of the node entity is created to reference it, allowing layout changes to be handled with the same workflow as normal content changes. Core also provides "inline blocks" that are instances of custom blocks referenced by the node but not shown in the global block layout admin view. Custom layout modules can be easily created to wrap a twig template for any layout needed within a section.īlocks for each field can be added to a section, along with any other predefined or custom block on the site. Core comes with one column, two column, and three column (33/33/33 and 25/50/25) layouts. The core Layout Discovery module is used to locate the available "layouts" on the site that can be assigned to a Section. Thus, a traditional view mode is just a single section with a one-column layout filled with a block for each field to be displayed. Each field of the entity can be displayed via a new field_block. With Layout Builder, a view mode consists of multiple "sections" that can contain multiple "blocks." A "Section" references a specific "Layout" (2 column, 3 column, etc). These simplistic lists of fields are usually passed to a theme template responsible for taking the raw field data and rendering it into the designed page. Normally in Drupal, a view mode is just a list of fields you want to display, and in which order. The Layout Builder module can take control over the rendering of an entity view mode. Wouldn't it be nice if there was a consistent way in Drupal 8 to create and manage these menus with a component-based design architecture? Layout Builder I've known many teams who simply groan when a client mentions "we want mega menus." Often these solutions caused headaches when migrating the site or supporting it over a long life cycle. ![]() ![]() These solutions had many problems and often didn't provide any easy way for site owners to make changes.
0 Comments
Leave a Reply. |