Skip to content

Instantly share code, notes, and snippets.

@DuaelFr
Created September 24, 2013 12:09
Show Gist options
  • Save DuaelFr/6683792 to your computer and use it in GitHub Desktop.
Save DuaelFr/6683792 to your computer and use it in GitHub Desktop.
Hide drupal tabs using a permission
<?php
/**
* Implements hook_permission().
*/
function MYMODULE_permission() {
return array(
'view contextual tabs' => array(
'title' => t('View contextual tabs'),
'restrict access' => TRUE,
),
);
}
/**
* Implements hook_preprocess_HOOK().
*/
function MYMODULE_preprocess_page(&$variables, $hook) {
if (!user_access('view contextual tabs')) {
$variables['tabs'] = array();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment