Commit 2d78ce73 authored by Nicholas Thompson's avatar Nicholas Thompson
Browse files

Restored a legacy command as requested in issue #427530. The removal of this...

Restored a legacy command as requested in issue #427530. The removal of this caused some sites to break
parent 1b6520d6
......@@ -247,9 +247,6 @@ function page_title_user($op, &$edit, &$account) {
* string the title for the current page
*/
function page_title_get_title() {
// Default to using the drupal internal title
$title = drupal_get_title();
// If we're looking at a node or a comment on a node, get the node object from the menu system.
if ((arg(0) == 'node' && is_numeric(arg(1))) || (arg(0) == 'comment' && arg(1) == 'reply' && is_numeric(arg(2))) && module_exists('comment')) {
$node = menu_get_object();
......@@ -258,11 +255,13 @@ function page_title_get_title() {
$title = $node->page_title;
}
}
// If we're looking at a user profile page, get the user title
elseif (arg(0) == 'user' && is_numeric(arg(1))) {
if (variable_get('page_title_user_showfield', 0) && ($user_title = page_title_load_title(arg(1), 'user'))) {
$title = $user_title;
}
}
// If we're looking at a taxonomy term page, get the term title
elseif (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2)) && module_exists('taxonomy')) {
$term = taxonomy_get_term(arg(2));
if (variable_get('page_title_vocab_'. $term->vid .'_showfield', 0) && ($term_title = page_title_load_title($term->tid, 'term'))) {
......@@ -270,6 +269,16 @@ function page_title_get_title() {
}
}
// If nothing above set a title, give the legacy function a chance to act
if (empty($title)) {
$title = page_title_set_title();
}
// If we still have no title, fall back to the title provided by Drupal Core
if (empty($title)) {
$title = drupal_get_title();
}
// Give other modules the oppertunity to use hook_page_title_alter().
drupal_alter('page_title', $title);
......@@ -303,6 +312,20 @@ function page_title_node_get_title($nid) {
}
/**
* Legacy page title setting function...
* NOTE: This has been depreicated in favour of hook_page_title_alter().
*/
function page_title_set_title($title = NULL) {
static $stored_title;
if (isset($title)) {
$stored_title = $title;
}
return $stored_title;
}
/**
* Determines what title should be sent to the page template.
*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment