This module helps developers consistently modify block forms, especially those used with Layout Builder. It provides dedicated functions to target and alter block forms based on their plugin type, simplifying custom form modifications.
The Block Form Alter module provides functions to alter block forms consistently across implementing plugins:
hook_block_plugin_form_alter()hook_block_type_form_alter()
Block forms are rendered by implementing plugins, which may require duplicate code in some instances where a developer desires to alter a given block form. This is particularly true when altering forms rendered by Layout Builder.
Supported Modules
- Block (core)
- Block Content (core)
- Layout Builder (core)
hook_block_plugin_form_alter()
The hook_block_plugin_form_alter() function allows for block forms to be targeted by plugin id. Block forms rendered by the 'block_content' and 'inline_block' plugins must be altered with hook_block_type_form_alter(). See block_form_alter.api.php for details.
hook_block_type_form_alter()
The hook_block_type_form_alter() function modifies block forms rendered by both Block Content ('block_content' plugin) and Layout Builder ('inline_block' plugin). See block_form_alter.api.php for details.
Related Core Issue
Ask your assistant about Block Form Alter
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
- block Drupal core
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 2.1.0 | Stable | 10–11 | Aug 26, 2024 |