You are here

function page_manager_poll_menu_alter in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 page_manager/plugins/tasks/poll.inc \page_manager_poll_menu_alter()

Callback defined by page_manager_poll_page_manager_tasks().

Alter the node edit input so that node edit comes to us rather than the normal node edit process.

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

File

page_manager/plugins/tasks/poll.inc, line 45

Code

function page_manager_poll_menu_alter(&$items, $task) {
  if (variable_get('page_manager_poll_disabled', TRUE)) {
    return;
  }
  $callback = $items['poll']['page callback'];

  // Override the node edit handler for our purpose.
  if ($callback == 'poll_page' || variable_get('page_manager_override_anyway', FALSE)) {
    $items['poll']['page callback'] = 'page_manager_poll';
    $items['poll']['file path'] = $task['path'];
    $items['poll']['file'] = $task['file'];
  }
  else {
    variable_set('page_manager_poll_disabled', TRUE);
    if (!empty($GLOBALS['page_manager_enabling_poll'])) {
      drupal_set_message(t('Page manager module is unable to enable poll because some other module already has overridden with %callback.', array(
        '%callback' => $callback,
      )), 'warning');
    }
    return;
  }
}