Integration with Drupal core's new Layout Builder

Created on 7 September 2018, about 6 years ago
Updated 9 March 2023, over 1 year ago

Drupal 8.5+ has the new layout builder module included in core (more info at https://events.drupal.org/nashville2018/sessions/site-building-20-how-la...).

This allows site builders to insert blocks into their layout visually (and not on the block administration page).

Block class currently does not give the option to set the CSS class within this interface (see the image below).

We should have a text field here to set the CSS class.

Feature request
Status

Needs review

Version

2.0

Component

Code

Created by

🇺🇸United States mherchel Gainesville, FL, US

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India vipin.j

    Rerolling this patch based on #81 for 2.0.x compatibility.

  • Status changed to Needs work over 1 year ago
  • 🇮🇳India munish.kumar

    #86 Patch does not apply, So moving this to needs work.

  • Status changed to Needs review about 1 year ago
  • 🇩🇪Germany szeidler Berlin

    Patch seems to have missed the an empty line at the end. This one should work. Unfortunately testing is not enabled for the 2.0.x branch. Could you please test?

  • 🇺🇸United States freelock Seattle

    On most of our newer sites, we've switched over to using Layout Builder Component Attributes instead of applying this patch, and that works fine without requiring a core patch -- and does more than this, allowing you to specify id, data- attributes, inline styles on not just the block but also the wrapper and the title (if your theme injects the attributes correctly).

    So we're now planning to convert our older sites that used this patch to use that module instead. I've opened an issue #3395068: Migration from block_class there to provide an upgrade path using a custom Drush command, if anyone else is interested.

  • 🇪🇪Estonia mmatsoo

    Simply reporting that patch https://www.drupal.org/files/issues/2023-10-01/2998114-88.patch applied successfully on 2.0.11

      - Installing drupal/block_class (2.0.11): Extracting archive
      - Applying patches for drupal/block_class
        https://www.drupal.org/files/issues/2023-10-01/2998114-88.patch (https://www.drupal.org/project/block_class/issues/2998114 Integration with Drupal core's new Layout Builder)
    
  • 🇺🇸United States freelock Seattle

    @mmatsoo the previous patch may apply, but I don't think it actually works.

    We have entirely moved over to Layout Builder Component Attributes for block classes within layouts (we still use Block Class with core block system placements).

    On #3395068: Migration from block_class , I've posted code we successfully used to update block_class usage inside all node and taxonomy term layout overrides. This doesn't update block_class usage on "manage display" pages (the templates) -- for those we just searched our config for usage of block_class, moved the classes from the block_class field to the manage attributes field, and then we could export the config. The update function is for content with layout overrides.

    Hope that helps anyone else stuck on this!

  • First commit to issue fork.
  • 🇩🇪Germany szeidler Berlin

    Thanks for sharing @freelock. Layout Builder Component Attributes seems really good.

    For the ones still relying on block class for this matter, here's a patch for block_class 2.0.12

Production build 0.71.5 2024