Home ›
Removing book navigationRemoving book navigation
Submitted by Benjamin Melançon on July 21, 2011 - 6:46pm
Remove book entirely, with hook_page_alter()
<?php
/**
* Implements hook_page_alter().
*/
function example_page_alter(&$page) {
// Remove the book module's navigation.
// dpm($page);
$nid = variable_get('sdl_about_daniel_nid', 18);
if (isset($page['content']['system_main']['nodes'][$nid]['book_navigation'])) {
unset($page['content']['system_main']['nodes'][$nid]['book_navigation']);
}
}
?>
Note: This can be done with a more targeted hook than hook_page_alter().
Or, at the opposite extreme, a surgical removal of the book listing pages, keeping the next/previous links:
<?php
function example_preprocess_book_navigation(&$variables) {
$variables['tree'] = '';
}
?>
Comments
Post new comment