In hook_block_view the menu name in $config['menu_name'] ends up being '_active', which is incorrect, when 'Menu selected by active page' is selected for the block configuration, This prevents the proper context links from being added to the block itself and one cannot access the manage menu/book outline from the block. Use $data['content']['#config']['menu_name']'s value instead.

Comments

Title:Use $data['content']['#config']['menu_name'] instead of $config['menu_name'] due to 'Menu selected by active page'Missing contextual links when using "Menu selected by active page" option
Status:Active» Postponed (maintainer needs more info)

The title of an issue should be a succinct summary of the issue. Note that the issue summary no longer has sufficient information now that I've changed the title.

I feel like you know what the proper fix for this is, but you haven't given enough information. Where does menu_block need to “Use $data['content']['#config']['menu_name'] instead of $config['menu_name']”?

Issue summary:View changes

Changed description to better describe the issue.

My apologies, I'm still a bit of a newb when it comes to these forums. Yes, I've patched this up for myself by changing hook_block_view() to read the data variable rather than the config. I didn't make a patch file for it but the change is fairly strait forward. Thanks!

function menu_block_block_view($delta = '') {
  $config = menu_block_get_config($delta);
  $data = menu_tree_build($config);
  // Add contextual links for this block.
  if (!empty($data['content'])) {
    if (in_array($data['content']['#config']['menu_name'], array_keys(menu_get_menus()))) {
      $data['content']['#contextual_links']['menu_block'] = array('admin/structure/menu/manage', array($data['content']['#config']['menu_name']));
    }
    elseif (strpos($data['content']['#config']['menu_name'], 'book-toc-') === 0) {
      $node = str_replace('book-toc-', '', $data['content']['#config']['menu_name']);
      $data['content']['#contextual_links']['menu_block'] = array('admin/content/book', array($node));
    }
  }
  return $data;
}

Status:Postponed (maintainer needs more info)» Active

Oh! I see.

Status:Active» Fixed

Actually, there's a simpler solution. Since menu_tree_build($config) is altering the menu_name part of the config why not let it alter the original configuration using &?

Fixed! http://drupalcode.org/project/menu_block.git/commitdiff/3b13bfd

Thanks!

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Issue summary:View changes

Added more info.