Block Style Plugins - Drupal 8 module tutorial

Опубликовано: 28 Июль 2026
на канале: Mark Miller
2,122
18

UPDATE: form fields can now be entirely added via the yaml file so that a themer never needs to create a PHP file.

UPDATE: defaultStyles() and formElements() have been deprecated. You should use defaultConfiguration() and buildConfigurationForm() instead. https://www.drupal.org/docs/8/modules...

The Block Style Plugins module allows developers and themers to create form elements for applying block-specific styles. This allows day-to-day editors the opportunity to change a block's appearance without needing to know CSS.

https://www.drupal.org/project/block_...

0:30 - Example plugins in /tests directory
1:56 - Defining plugins in a Theme
5:08 - Restricting styles to specific blocks with "include"
6:13 - Using Drupal's Form API to add conditional style options
8:14 - How to discover a block's Base Plugin ID
9:10 - Including only a specific custom Block Content type
9:44 - Excluding styles from specific blocks with "exclude"