You are here

function access_unpublished_menu_local_tasks_alter in Access unpublished 7

Implements menu_local_tasks_alter().

File

./access_unpublished.module, line 142
Drupal module: Access unpublished.

Code

function access_unpublished_menu_local_tasks_alter(&$data, $router_item, $root_path) {

  // Do we need to bother doing anything?
  if (empty($data['tabs'][0]['output'])) {
    return;
  }
  if (user_is_anonymous()) {
    if (isset($data['tabs'])) {

      //We do not want the anonymous account to see the workbench tabs when looking at a draft page.
      unset($data['tabs'][0]['output']);

      //To avoid core from throwing a notice when it looks for output, set it to an empty array.
      $data['tabs'][0]['output'] = array();
    }
  }
}