function settings_tray_block_view_alter
Same name in other branches
- 9 core/modules/settings_tray/settings_tray.module \settings_tray_block_view_alter()
- 8.9.x core/modules/settings_tray/settings_tray.module \settings_tray_block_view_alter()
- 10 core/modules/settings_tray/settings_tray.module \settings_tray_block_view_alter()
Implements hook_block_view_alter().
File
-
core/
modules/ settings_tray/ settings_tray.module, line 78
Code
function settings_tray_block_view_alter(array &$build) {
if (isset($build['#contextual_links']['block'])) {
// Ensure that contextual links vary by whether the block has config overrides
// or not.
// @see _contextual_links_to_id()
$build['#contextual_links']['block']['metadata']['has_overrides'] = _settings_tray_has_block_overrides($build['#block']) ? 1 : 0;
}
// Force a new 'data-contextual-id' attribute on blocks when this module is
// enabled so as not to reuse stale data cached client-side.
// @todo Remove when https://www.drupal.org/node/2773591 is fixed.
$build['#contextual_links']['settings_tray'] = [
'route_parameters' => [],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.