You are here

function page_manager_comment_reply_page in Chaos Tool Suite (ctools) 7

Entry point for our overridden comment.

1 string reference to 'page_manager_comment_reply_page'
page_manager_comment_reply_menu_alter in page_manager/plugins/tasks/comment_reply.inc
Callback defined by page_manager_node_view_page_manager_tasks().

File

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

Code

function page_manager_comment_reply_page($node, $pid = NULL) {

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

  // Load the node into a context.
  ctools_include('context');
  ctools_include('context-task-handler');
  $contexts = ctools_context_handler_get_task_contexts($task, '', array(
    $node,
    $pid,
  ));
  if (array_key_exists('argument_cid_3', $contexts) && $contexts['argument_cid_3']->data->nid != $node->nid) {

    // Attempting to reply to a comment not belonging to the current nid.
    drupal_set_message(t('The comment you are replying to does not exist.'), 'error');
    drupal_goto("node/{$node->nid}");
  }
  $output = ctools_context_handler_render($task, '', $contexts, array(
    $node,
    $pid,
  ));
  if ($output !== FALSE) {
    return $output;
  }
  $function = 'comment_reply';
  foreach (module_implements('page_manager_override') as $module) {
    $call = $module . '_page_manager_override';
    if (($rc = $call('comment_reply')) && function_exists($rc)) {
      $function = $rc;
      break;
    }
  }
  module_load_include('inc', 'comment', 'comment.pages');
  return $function($node, $pid);
}