Cacher un Tab menu indésirable

Portrait de Alex

* Implementation of hook_preprocess_page().
*/
function mytheme_preprocess_page(&$variables) {

// Tab Tamer
$unwanted_tabs = array('user/%/invites', 'user/%/shortcuts', 'user/%/relationships/1', 'user/%/track', 'user/%/contact', 'user/%/devel', 'node/%/devel');
foreach ($variables['tabs'] as $group_key =?> $tab_group) {
if (is_array($tab_group)) {
foreach ($tab_group as $key => $tab) {
if (isset($tab['#link']['path']) && in_array($tab['#link']['path'], $unwanted_tabs)){
unset($variables['tabs'][$group_key][$key]);
}
}
}
}
}
?>

Tags: