You are here

function page_manager_comment_reply_menu_alter in Chaos Tool Suite (ctools) 7

Callback defined by page_manager_node_view_page_manager_tasks().

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

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

File

page_manager/plugins/tasks/comment_reply.inc, line 128

Code

function page_manager_comment_reply_menu_alter(&$items, $task) {
  if (variable_get('page_manager_comment_reply_disabled', TRUE)) {
    return;
  }

  // Override the node view handler for our purpose.
  $callback = $items['comment/reply/%node']['page callback'];
  if ($callback == 'comment_reply' || variable_get('page_manager_override_anyway', FALSE)) {
    $items['comment/reply/%node']['page callback'] = 'page_manager_comment_reply_page';
    $items['comment/reply/%node']['file path'] = $task['path'];
    $items['comment/reply/%node']['file'] = $task['file'];
  }
  else {

    // Automatically disable this task if it cannot be enabled.
    variable_set('page_manager_comment_reply_disabled', TRUE);
    if (!empty($GLOBALS['page_manager_enabling_comment_reply'])) {
      drupal_set_message(t('Page manager module is unable to enable comment/reply/%node because some other module already has overridden with %callback.', array(
        '%callback' => $callback,
      )), 'error');
    }
  }

  // @todo override node revision handler as well?
}