You are here

function settings_tray_block_alter in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/settings_tray/settings_tray.module \settings_tray_block_alter()
  2. 9 core/modules/settings_tray/settings_tray.module \settings_tray_block_alter()

Implements hook_block_alter().

Ensures every block plugin definition has an 'settings_tray' form specified.

See also

\Drupal\settings_tray\Access\BlockPluginHasSettingsTrayFormAccessCheck

File

core/modules/settings_tray/settings_tray.module, line 167
Allows configuring blocks and other configuration from the site front-end.

Code

function settings_tray_block_alter(&$definitions) {
  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'] = $definition['class'];
    }
  }
}