Home ›
Capturing Menu Block configuration in code with hook_menu_block_blocks()Capturing Menu Block configuration in code with hook_menu_block_blocks()
Submitted by Benjamin Melançon on September 5, 2011 - 2:36pm
<?php
/**
* Implements hook_menu_block_blocks().
*/
function feature_about_menu_block_blocks() {
$nid = variable_get('sdl_about_daniel_nid', 18);
$pmlid = db_query('SELECT mlid FROM {menu_links} WHERE link_path = :link_path AND module = :module', array(':link_path' => 'node/' . $nid, ':module' => 'book'))->fetchField();
// The array key is the block delta used by menu block.
return array(
'feature_about-1' => array(
'menu_name' => 'book-toc-' . $nid,
'parent_mlid' => $pmlid, // variable_get('sdl_about_daniel_parent_mlid', 298),
'title_link' => 0,
'admin_title' => 'About section book navigation menu block',
'level' => 1,
'follow' => 0,
'depth' => 2,
'expanded' => 1,
'sort' => 0,
),
);
}
?>More like this
- Adding non-menu things to primary links menu items with Drupal 7's page alter hook
- Return user to current page: How to link to a form from a Drupal menu
- Fixing Menu Block for menu items with the same path (that also have another valid path)
- Make modifications to a sidebar block menu that primarily mirrors top-level drop-down menu
- Drupal 7 hook_block changes, with example template module | EchoDitto Labs


Comments
Post new comment