You are here

function tvi_get_view_info in Taxonomy Views Integrator 6

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

Returns information about the term, view, and settings found for the arguments given to the taxonomy term callback.

2 calls to tvi_get_view_info()
tvi_render_view in ./tvi.module
Replaces taxonomy page callback
tvi_render_view_access in ./tvi.module
Checks access for the current taxonomy page.

File

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

Code

function tvi_get_view_info($str_tids) {
  $terms = taxonomy_terms_parse_string($str_tids);

  // Defaults
  $term = $view = $settings = NULL;
  if (count($terms['tids']) == 1) {
    if ($info = tvi_get_term_info($terms['tids'][0], TVI_DATATYPE_ALL)) {
      $term = $info->term;
      $view = $info->view;
      $settings = $info->settings;
    }
    else {
      $term = $view = $settings = NULL;
    }
    if (is_object($view) && is_object($settings) && $settings->status) {
      $display = $settings->display;
    }
  }
  if (!variable_get('tvi_default_view_skip', 0) && !($view && $display)) {
    list($view, $display) = tvi_get_default_view($str_tids);
  }

  // Important things to consider:
  //
  // * If this is a default view, then $settings will be NULL.
  // * The variable $term might be NULL if this is a multi term request.
  // * If $view or $display are NULL, then nothing was found.
  return array(
    $view,
    $display,
    $term,
    $settings,
  );
}