Instantly share code, notes, and snippets.
markcarver/menu-tree.vars.php
Last active Aug 29, 2015
Menu tree context alter
<?php | |
/** | |
* Implements hook_theme_registry_alter(). | |
*/ | |
function THEMENAME_theme_registry_alter(&$theme_registry) { | |
array_unshift($theme_registry['menu_tree']['preprocess functions'], 'THEMENAME_menu_tree_alter'); | |
} | |
/** | |
* Helper function for adding the tree context to the variables. | |
* | |
* A faux "hook_menu_tree_alter()" if you will. | |
*/ | |
function THEMENAME_menu_tree_alter(&$variables) { | |
// Save the original tree render array so it can be | |
// used in future theme preprocessors. | |
$variables['#tree'] = $variables['tree']; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment