You are here

function workbench_moderation_nodedraft_menu_alter in Workbench Moderation 7.3

Same name and namespace in other branches
  1. 7 plugins/page_manager/tasks/nodedraft.inc \workbench_moderation_nodedraft_menu_alter()

Callback defined by workbench_moderation_nodedraft_page_manager_tasks().

Alter menu item so that admin/workbench comes here.

1 string reference to 'workbench_moderation_nodedraft_menu_alter'
workbench_moderation_nodedraft_page_manager_tasks in plugins/page_manager/tasks/nodedraft.inc
Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for more information.

File

plugins/page_manager/tasks/nodedraft.inc, line 38

Code

function workbench_moderation_nodedraft_menu_alter(&$items, $task) {
  if (variable_get('workbench_moderation_nodedraft_disabled', TRUE)) {
    return;
  }
  $callback = $items['node/%node/draft']['page callback'];

  // Override the node edit handler for our purpose.
  if ($callback == 'workbench_moderation_node_view_draft' || variable_get('page_manager_override_anyway', FALSE)) {
    $items['node/%node/draft']['page callback'] = 'workbench_moderation_nodedraft';
    $items['node/%node/draft']['file path'] = $task['path'];
    $items['node/%node/draft']['file'] = $task['file'];
  }
  else {

    //variable_set('workbench_moderation_nodedraft_disabled', TRUE);
    if (!empty($GLOBALS['page_manager_enabling_workbench'])) {
      drupal_set_message(t('Page manager module is unable to enable Workbench Moderation Draft Node because some other module already has overridden with %callback.', array(
        '%callback' => $callback,
      )), 'warning');
    }
    return;
  }
}