You are here

function page_manager_search_page in Chaos Tool Suite (ctools) 7

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

Entry point for our overridden search page.

1 string reference to 'page_manager_search_page'
page_manager_search_menu_alter in page_manager/plugins/tasks/search.inc
Callback defined by page_manager_search_page_manager_tasks().

File

page_manager/plugins/tasks/search.inc, line 99
Handle the 'node view' override task.

Code

function page_manager_search_page($type) {

  // Get the arguments and construct a keys string out of them.
  $args = func_get_args();
  ctools_include('menu');

  // We have to remove the $type.
  array_shift($args);

  // And implode() it all back together.
  $keys = $args ? implode('/', $args) : '';

  // Allow other modules to alter the search keys.
  drupal_alter(array(
    'search_keys',
    'search_' . $type . '_keys',
  ), $keys);

  // Load my task plugin.
  $task = page_manager_get_task('search');
  $subtask = page_manager_get_task_subtask($task, $type);

  // Load the node into a context.
  ctools_include('context');
  ctools_include('context-task-handler');
  $contexts = ctools_context_handler_get_task_contexts($task, $subtask, array(
    $keys,
  ));
  $output = ctools_context_handler_render($task, $subtask, $contexts, array(
    $keys,
  ));
  if ($output !== FALSE) {
    return $output;
  }
  $function = 'search_view';
  foreach (module_implements('page_manager_override') as $module) {
    $call = $module . '_page_manager_override';
    if (($rc = $call('search')) && function_exists($rc)) {
      $function = $rc;
      break;
    }
  }

  // Otherwise, fall back.
  // Put the $type back on the arguments.
  module_load_include('inc', 'search', 'search.pages');
  array_unshift($args, $type);
  return call_user_func_array($function, $args);
}