function book_menus_theme_registry_alter in Book Menus 7
Implements hook_theme_registry_alter().
Make our preprocess function run before book.module's.
File
- ./
book_menus.module, line 202 - Functionality for book_menus.module.
Code
function book_menus_theme_registry_alter(&$theme_registry) {
// Make sure that the book navigation theme entry is present.
if (!empty($theme_registry['book_navigation']['preprocess functions'])) {
// Save the template function.
$template_function = 'template_preprocess_book_navigation';
// Get the current function order.
$functions_old = $theme_registry['book_navigation']['preprocess functions'];
// Make sure the one we want is in there.
if (!in_array($template_function, $functions_old)) {
// Functions not there, bail out.
return NULL;
}
// Get the template function index.
$index = array_search($template_function, $functions_old);
// Set the new order.
$theme_registry['book_navigation']['preprocess functions'] = array_merge(array_slice($functions_old, 0, $index), array(
'book_menus_preprocess_book_navigation_before',
), array_slice($functions_old, $index));
}
}