function _panels_page_get_title in Panels 5.2
Same name and namespace in other branches
- 6.2 panels_page/panels_page.read.inc \_panels_page_get_title()
1 call to _panels_page_get_title()
- panels_page_get_title in panels_page/
panels_page.module - Get the title for a panel page, given a context.
File
- panels_page/
panels_page.module, line 469 - panels_page.module
Code
function _panels_page_get_title($panel_page, $op, $default_title) {
if ($op == 'menu-parent' && $panel_page->menu_parent_title) {
return $panel_page->menu_parent_title;
}
if (in_array($op, array(
'menu',
'menu-parent',
)) && $panel_page->menu_title) {
return $panel_page->menu_title;
}
// Context has the highest priority
if (!empty($panel_page->context)) {
$title = NULL;
foreach ($panel_page->context as $context) {
if (empty($context->data)) {
// Empty contexts can't provide titles
continue;
}
if ($page_title = $context
->get_page_title()) {
$title = $page_title;
}
}
if ($title) {
return $title;
}
}
// If no context returned a title use the display title configured in layout
// settings
if (!empty($panel_page->display->title)) {
return $panel_page->display->title;
}
// Fall back on the panel default title
if (!empty($panel_page->title)) {
return $panel_page->title;
}
if (is_null($default_title)) {
return t('No title');
}
else {
return $default_title;
}
}