You are here

function tvi_render_view in Taxonomy Views Integrator 6

Same name and namespace in other branches
  1. 7 tvi.module \tvi_render_view()

Replaces taxonomy page callback

If more or less than one term is given then pass the request off to the original taxonomy module page callback.

@todo Enable support for > 1 term. @todo Enable views to use their own arguments - now only tid and depth are passed in (ln 229, 232)

1 string reference to 'tvi_render_view'
tvi_menu_alter in ./tvi.module
Implements hook_menu_alter().

File

./tvi.module, line 217
Enables use of views for taxonomy pages.

Code

function tvi_render_view($str_tids = '', $depth = 0, $op = 'page') {
  list($view, $display, $term, $settings) = tvi_get_view_info($str_tids);
  $desc = $settings->description_enabled ? theme('tvi_term_description', $term) : '';
  if (is_object($view) && $display) {
    $view
      ->set_display($display);

    // Using the TVI selected view.
    if (is_object($term) && is_object($settings) && $settings->status) {
      $depth = tvi_get_view_depth($view, $display);
      $view
        ->set_arguments(array(
        $term->tid,
        $depth,
      ));
    }
    else {
      $view
        ->set_arguments(array(
        $str_tids,
        $depth,
      ));
    }
    $view
      ->build();
    drupal_set_title(theme('tvi_title', $term, $view));
    drupal_set_breadcrumb(theme('tvi_breadcrumb', $term, $view));

    // We might be using the default view.
    return $desc . $view
      ->preview();
  }

  // Taxonomy is last resort - used if no standard views are found
  module_load_include('inc', 'taxonomy', 'taxonomy.pages');
  return taxonomy_term_page($str_tids, $depth, $op);
}