function tvi_get_default_view in Taxonomy Views Integrator 6
Finds views in the system that can be used to display the specified taxonomy term(s) and are outside of the TVI framework.
This is a helper function so that we can, in the case there is no TVI view, pass the display off to an applicable view rather than simply using taxonomy displays alone.
1 call to tvi_get_default_view()
- tvi_get_view_info in ./
tvi.module - Returns information about the term, view, and settings found for the arguments given to the taxonomy term callback.
File
- ./
tvi.module, line 345 - Enables use of views for taxonomy pages.
Code
function tvi_get_default_view($str_tids) {
static $default_views = array();
if (!array_key_exists($str_tids, $default_views)) {
$default_views[$str_tids] = array(
NULL,
NULL,
);
$views = views_get_all_views();
foreach ($views as $view) {
if (!$view->disabled) {
foreach ($view->display as $name => $display) {
// Each view can have multiple displays. These may have a path
// specified.
$plugin = $display->display_plugin;
// It has a path or it is not eligable.
if (!in_array($plugin, array(
'block',
'feed',
'default',
))) {
$path = $display->display_options['path'];
if (!$path) {
continue;
}
// Exact match
if (preg_match("/^taxonomy\\/term\\/{$str_tids}/", $path)) {
$default_views[$str_tids] = array(
$view,
$name,
);
$is_done = TRUE;
break;
// Return immediately
}
elseif (preg_match("/^taxonomy\\/term\\/%/", $path)) {
$default_views[$str_tids] = array(
$view,
$name,
);
}
}
}
}
if ($is_done) {
break;
}
}
}
return $default_views[$str_tids];
}