function views_get_title in Views (for Drupal 7) 5
Figure out what the title of a view should be.
8 calls to views_get_title()
- theme_views_rss_feed in ./
views_rss.module - plugin that actually displays an RSS feed
- theme_views_view in ./
views.module - Display a view.
- views_block in ./
views.module - Implementation of hook_block()
- views_rss_views_feed_argument in ./
views_rss.module - feed argument hook that will convert us to RSS or display an icon. the 4th argument isn't part of the hook, but we use it to differentiate when called as a hook or when called manually from views_rss_views_post_view
- views_set_breadcrumb in ./
views.module
File
- ./
views.module, line 732
Code
function views_get_title($view, $context = 'menu', $args = NULL) {
if ($context == 'menu-parent' && $view->menu_parent_title) {
return $view->menu_parent_title;
}
if (($context == 'menu' || $context == 'menu-parent' || $context == 'admin') && $view->menu_title) {
return $view->menu_title;
}
if ($context == 'block-info') {
return $view->description ? $view->description : $view->name;
}
if ($args === NULL) {
$args = $view->args;
}
// Grab the title from the highest argument we got. If there is no such
// title, track back until we find a title.
if (is_array($args)) {
$rargs = array_reverse(array_keys($args));
foreach ($rargs as $arg_id) {
if ($title = $view->argument[$arg_id]['title']) {
break;
}
}
}
if (!$title && ($context == 'menu' || $context == 'menu-parent' || $context == 'page' || $context == 'admin')) {
$title = $view->page_title;
}
if (!$title && ($context == 'block' || $context == 'admin')) {
$title = $view->block_title;
}
if (!$view->argument) {
return $title;
}
views_load_cache();
$arginfo = _views_get_arguments();
foreach ($view->argument as $i => $arg) {
if (!isset($args[$i])) {
break;
}
$argtype = $arg['type'];
if ($arg['wildcard'] == $args[$i] && $arg['wildcard_substitution'] != '') {
$title = str_replace("%" . ($i + 1), $arg['wildcard_substitution'], $title);
}
else {
if (function_exists($arginfo[$argtype]['handler'])) {
// call the handler
$rep = $arginfo[$argtype]['handler']('title', $args[$i], $argtype);
$title = str_replace("%" . ($i + 1), $rep, $title);
}
}
}
return $title;
}