function SettingsTrayHooks::blockAlter
Same name and namespace in other branches
- 11.x core/modules/settings_tray/src/Hook/SettingsTrayHooks.php \Drupal\settings_tray\Hook\SettingsTrayHooks::blockAlter()
Implements hook_block_alter().
Ensures every block plugin definition has an 'settings_tray' form specified.
Attributes
#[Hook('block_alter')]
See also
\Drupal\settings_tray\Access\BlockPluginHasSettingsTrayFormAccessCheck
File
-
core/
modules/ settings_tray/ src/ Hook/ SettingsTrayHooks.php, line 142
Class
- SettingsTrayHooks
- Hook implementations for settings_tray.
Namespace
Drupal\settings_tray\HookCode
public function blockAlter(&$definitions) : void {
foreach ($definitions as &$definition) {
// If a block plugin does not define its own 'settings_tray' form, use the
// plugin class itself.
if (!isset($definition['forms']['settings_tray'])) {
$definition['forms']['settings_tray'] = match ($definition['id']) { 'help_block' => FALSE,
'page_title_block' => FALSE,
'system_branding_block' => SystemBrandingOffCanvasForm::class,
'system_main_block' => FALSE,
'system_menu_block' => SystemMenuOffCanvasForm::class,
default => $definition['class'],
};
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.