function SettingsTrayHooks::blockAlter

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/src/Hook/SettingsTrayHooks.php, line 134

Class

SettingsTrayHooks
Hook implementations for settings_tray.

Namespace

Drupal\settings_tray\Hook

Code

public function blockAlter(&$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.