You are here

function workbench_moderation_nodedraft in Workbench Moderation 7

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

Entry point for our overridden My Workbench.

This function asks its assigned handlers who, if anyone, would like to run with it. If no one does, it passes through to the main node draft page.

1 string reference to 'workbench_moderation_nodedraft'
workbench_moderation_nodedraft_menu_alter in plugins/page_manager/tasks/nodedraft.inc
Callback defined by workbench_moderation_nodedraft_page_manager_tasks().

File

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

Code

function workbench_moderation_nodedraft($node) {

  // Load my task plugin
  $task = page_manager_get_task('nodedraft');

  // Get the most recent revision to pass to the task handler.
  $current_node = workbench_moderation_node_current_load($node);

  // Load the node into a context.
  ctools_include('context');
  ctools_include('context-task-handler');
  $contexts = ctools_context_handler_get_task_contexts($task, '', array(
    $current_node,
  ));
  $output = ctools_context_handler_render($task, '', $contexts, array(
    $current_node->nid,
  ));
  if ($output !== FALSE) {
    return $output;
  }
  module_load_include('inc', 'workbench_moderation', 'workbench_moderation.node');
  $function = 'workbench_moderation_node_view_draft';
  foreach (module_implements('page_manager_override') as $module) {
    $call = $module . '_page_manager_override';
    if (($rc = $call('workbench')) && function_exists($rc)) {
      $function = $rc;
      break;
    }
  }

  // Otherwise, fall back.
  return $function($node);
}