Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.