Menu block configuration no longer updating on hook_block_view_alter or hook_block_build_alter

Created on 21 June 2024, 10 months ago

In version 1.10 and prior, I was able to programmatically manipulate the menu block parent, depth, etc., within either the hook_block_view_alter or hook_block_build_alter hooks.

Below is simple example code that no longer works on v 1.11:

function modulename_block_build_alter(array &$build, BlockPluginInterface $block) {

    if ($block->getBaseId() == 'menu_block') {

      if ($block->getPluginId() == 'menu_block:main') {

        $block_config = $block->getConfiguration();

        // assign new menu parent item
        $block_config['parent'] .= <strong>$new_menu_item_plugin_id</strong>;
        $block->setConfiguration($block_config);

      }

    }

}

If this were hook_block_view_alter, I would end with a call to $block->build().

However, the menu remains unchanged, regardless of which configuration value I try to set in either hook.

🐛 Bug report
Status

Needs review

Version

1.11

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024