You are here

function menu_block_block_view_alter in Menu Block 7.3

Same name and namespace in other branches
  1. 7.2 menu_block.module \menu_block_block_view_alter()

Implements hook_block_view_alter().

1 call to menu_block_block_view_alter()
menu_block_menu_tree_content_type_render in plugins/content_types/menu_tree/menu_tree.inc
Renders a menu_tree content type based on the delta supplied in the configuration.

File

./menu_block.module, line 170
Provides configurable blocks of menu items.

Code

function menu_block_block_view_alter(&$data, $block) {

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