function MenuUiHooks::blockViewSystemMenuBlockAlter

Implements hook_block_view_BASE_BLOCK_ID_alter() for 'system_menu_block'.

File

core/modules/menu_ui/src/Hook/MenuUiHooks.php, line 77

Class

MenuUiHooks
Hook implementations for menu_ui.

Namespace

Drupal\menu_ui\Hook

Code

public function blockViewSystemMenuBlockAlter(array &$build, BlockPluginInterface $block) {
    if ($block->getBaseId() == 'system_menu_block') {
        $menu_name = $block->getDerivativeId();
        $build['#contextual_links']['menu'] = [
            'route_parameters' => [
                'menu' => $menu_name,
            ],
        ];
    }
}

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