When Layout Builder was introduced into Drupal 8 Core, it gave Site Builders a tremendous amount of flexibility previously reserved for Front End Developers (or Themers). While it represents a major leap for Drupal, there are still some shortcomings in the module, and that’s where some great additional contributed modules are really helping.
In this blog post, we will highlight three of the best modules currently available. (Note: more are being added all the time!). For a complete list of contributed modules for Layout Builder, visit https://www.drupal.org/docs/8/core/modules/layout-builder/additional-modules.
Layout Builder Styles
This module allows site builders to select from a list of styles to apply to layout builder blocks and layout builder sections. Created by Brian Osborne (bkosborne) a Senior Web Developer from Princeton University, this module makes it incredibly simple to apply previously defined CSS styles to both sections and blocks (you’ll need those styles in a stylesheet in your theme or use a module like Asset Injector).
A “style” is just a representation of one or more CSS classes that will be applied. Additionally for blocks, a block template suggestion is added for the selected style.
A simple user interface is provided for managing the styles available. Since a style is a configuration entity, it can be exported and imported just like any other configuration data on your site.
Please note that this module requires Drupal 8.7.0 at a minimum. The full documentation is here at https://www.drupal.org/docs/8/modules/layout-builder-styles. At the time of this writing, the module is still in beta; however, we’ve used it a number of times without issue.
Layout Builder Library
With this module, Site builders can create and deploy pre-defined layouts for each entity-type and bundle combination. Content editors can then select from existing layouts.
Also, Site admins can prevent content-editors from creating their own bespoke layouts, but give them the ability to customize layouts on a per-content-item basis.
This module is also in Beta at the time of this writing; however, it is recommended by the project’s maintainer, and we’ve had no issues with it.
Layout Builder Restrictions
Out of the box, the Layout Builder “Manage Display” interface shows all blocks (including all entity-specific fields), and all layouts that are registered in the system. This module provides an interface for suppressing blocks and/or layouts. Sites can allow all options from a certain provider, or restrict all options by provider, or specify individual allowed blocks & layouts.
Created by Mark Fullmer (mark_fullmer) from the University of Texas.
This module is very helpful in restricting what a content editor sees when they click add section or block.
Restricting the layouts a content editor can choose, can prevent any “over-creativity” from creeping into your site. By restricting blocks, the entire interface becomes less confusing. The reasoning here is why should we display blocks (or anything) that we would never want to be added to a node?
This module is in version 2.4 as of this writing, and is recommended by the project’s maintainer. Mark has also committed to ensuring compatibility with Drupal 9.
Layout Builder is a game-changer for Drupal Site Builders. These three additional modules really help make it easier to use!
Newcomers to Layout Builder in Drupal 8 should check out our 30-minute video class at https://www.ostraining.com/class/drupal-8-layout-builder/