You are here

function page_manager_term_view in Chaos Tool Suite (ctools) 6

Entry point for our overridden term view.

This function asks its assigned handlers who, if anyone, would like to run with it. If no one does, it passes through to Drupal core's term view, which is term_page_view().

1 string reference to 'page_manager_term_view'
page_manager_term_view_menu_alter in page_manager/plugins/tasks/term_view.inc
Callback defined by page_manager_term_view_page_manager_tasks().

File

page_manager/plugins/tasks/term_view.inc, line 96
Handle the 'term view' override task.

Code

function page_manager_term_view($terms, $depth = 0, $op = 'page') {

  // While we ordinarily should never actually get feeds through here,
  // just in case
  if ($op != 'feed') {

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

    // Load the term into a context.
    ctools_include('context');
    ctools_include('context-task-handler');
    $contexts = ctools_context_handler_get_task_contexts($task, '', array(
      $terms,
      $depth,
    ));
    if (empty($contexts)) {
      return drupal_not_found();
    }

    // Add a fake tab for 'View' so that edit tabs can be added.
    if (user_access('administer page manager')) {
      ctools_include('menu');
      ctools_menu_add_tab(array(
        'title' => t('View'),
        'href' => $_GET['q'],
        'type' => MENU_DEFAULT_LOCAL_TASK,
        'weight' => -10,
      ));
    }
    $output = ctools_context_handler_render($task, '', $contexts, array(
      $terms,
      $depth,
      $op,
    ));
    if ($output !== FALSE) {
      return $output;
    }
  }

  // Otherwise, fall back.
  module_load_include('inc', 'taxonomy', 'taxonomy.pages');
  return taxonomy_term_page($terms, $depth, $op);
}