function settings_tray_block_alter

Same name in other branches
  1. 9 core/modules/settings_tray/settings_tray.module \settings_tray_block_alter()
  2. 10 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

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'];
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.