Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

lb_styles_conditions

154 sites Security covered
View on drupal.org

A Drupal module that allows you to control access to Layout Builder Styles based on configurable conditions.

Overview

Layout Builder Styles: Conditions provides a flexible way to control what Layout Builder Styles are available on your Drupal site. This module extends Layout Builder Styles to include conditional rules, making it easy to control styles based on various conditions.

But why?

The benefit of this approach is for multi-sites, or shared codebase platforms, that share configuration across multiple sites but want some flexibility in control of what styles are available. For example, if there are two sites sharing the same codebase, Site A and Site B, and only Site B needs a particular Layout Builder Style to be available, we are able to configure availability based on a condition - this could be one provided by core, the contrib space, or something custom. This way both sites can still share the same configuration, as the conditions are stored in config, but are evaluated per-site.

Requirements

- Layout Builder Styles

Installation

1. Download the module:
You can download the module using Composer:

composer require drupal/lb_styles_conditions

2. Enable the module:
After downloading, enable the module using Drush or the Drupal admin interface:

drush en lb_styles_conditions

Or, enable it through the admin interface at /admin/modules.

Configuration

The module offers the ability to specify which conditions can be used to control Layout Builder Styles availability.

Extending the module

Developers can alter the available conditions using the provided hook:

/**
 * Implements hook_lb_styles_conditions_available_conditions_alterr().
 */
function hook_lb_styles_conditions_available_conditions_alter(array &$conditions, ?FormStateInterface $form_state = NULL, ?string $form_id = NULL): void {
  // Remove specific conditions
  $conditions_to_remove = [
    'language',
    'request_path',
  ];
  $conditions = array_diff_key($conditions, array_flip($conditions_to_remove));
}

Contributing

Contributions are welcome! If you would like to contribute to this module, please follow these steps:

1. Open an issue on the issue tracker
2. Create a Merge Request or add a patch
3. Mark your issue as Needs Review.

License

This module is licensed under the GPL-2.0+ license.

Maintainers

- Owen Bush

Activity

Total releases
2
First release
May 2025
Latest release
10 months ago
Release cadence
17 days
Stability
100% stable

Releases

Version Type Release date
2.0.0 Stable May 19, 2025
1.0.0 Stable May 2, 2025