diff -ruN ./modules/page_title.page_title.inc ../page_title_updated/modules/page_title.page_title.inc --- ./modules/page_title.page_title.inc 2012-05-09 11:28:00.000000000 +0200 +++ ../page_title_updated/modules/page_title.page_title.inc 2014-06-12 15:46:52.412275329 +0200 @@ -7,9 +7,9 @@ /** - * Implements hook_page_title_alter(). + * Get the default title set by drupal */ -function page_title_page_title_alter(&$title) { +function page_title_default(&$title) { // If nothing above set a title, give the legacy function a chance to act if (empty($title)) { $title = page_title_set_title(); diff -ruN ./page_title.module ../page_title_updated/page_title.module --- ./page_title.module 2012-05-09 11:28:00.000000000 +0200 +++ ../page_title_updated/page_title.module 2014-06-12 15:47:14.188009060 +0200 @@ -534,7 +534,6 @@ */ function page_title_get_title($raw = FALSE, $flush = FALSE) { $title = &drupal_static(__FUNCTION__); - if ($flush || is_null($title)) { // Give other modules the oppertunity to use hook_page_title_alter(). drupal_alter('page_title', $title); @@ -600,22 +599,34 @@ $title = &drupal_static(__FUNCTION__); if (is_null($title)) { - $types = array('global' => NULL); - // Allow hook_page_title_pattern_alter() to modify the pattern and tokens - drupal_alter('page_title_pattern', $page_title_pattern, $types); + // First case : try to get the custom title for the current page + $title = page_title_get_title(); - // If pattern is empty (either if the type is not overridable or simply not set) fallback to the default pattern - if (empty($page_title_pattern)) { - $settings = page_title_get_settings(); - $page_title_pattern = variable_get('page_title_default', $settings['page_title_default']['default']); - } + // If there is none, try to get the define pattern for the current page type (node type, etc ...) + if (empty($title)) { + $types = array('global' => NULL); + + // Allow hook_page_title_pattern_alter() to modify the pattern and tokens + drupal_alter('page_title_pattern', $page_title_pattern, $types); + + // If pattern is empty (either if the type is not overridable or simply not set) fallback to the default pattern + if (empty($page_title_pattern)) { + $settings = page_title_get_settings(); + $page_title_pattern = variable_get('page_title_default', $settings['page_title_default']['default']); + } - // Append the pattern for pages with a pager on them - $page_title_pattern .= isset($_REQUEST['page']) ? variable_get('page_title_pager_pattern', '') : ''; + // Append the pattern for pages with a pager on them + $page_title_pattern .= isset($_REQUEST['page']) ? variable_get('page_title_pager_pattern', '') : ''; - // Apply token patterns using token_replace - $title = token_replace($page_title_pattern, $types, array('sanitize' => FALSE)); + // Apply token patterns using token_replace + $title = token_replace($page_title_pattern, $types, array('sanitize' => FALSE)); + } + + // If there is still nothing, get the default title + if (empty($title)) { + page_title_default($title); + } } // Trim trailing whitespace from the title diff -ruN ./page_title.patch ../page_title_updated/page_title.patch --- ./page_title.patch 2014-06-12 15:47:56.619482353 +0200 +++ ../page_title_updated/page_title.patch 1970-01-01 01:00:00.000000000 +0100 @@ -1,73 +0,0 @@ -diff -ruN ./modules/page_title.page_title.inc ../page_title_updated/modules/page_title.page_title.inc ---- ./modules/page_title.page_title.inc 2012-05-09 11:28:00.000000000 +0200 -+++ ../page_title_updated/modules/page_title.page_title.inc 2014-06-12 15:46:52.412275329 +0200 -@@ -7,9 +7,9 @@ - - - /** -- * Implements hook_page_title_alter(). -+ * Get the default title set by drupal - */ --function page_title_page_title_alter(&$title) { -+function page_title_default(&$title) { - // If nothing above set a title, give the legacy function a chance to act - if (empty($title)) { - $title = page_title_set_title(); -diff -ruN ./page_title.module ../page_title_updated/page_title.module ---- ./page_title.module 2012-05-09 11:28:00.000000000 +0200 -+++ ../page_title_updated/page_title.module 2014-06-12 15:47:14.188009060 +0200 -@@ -534,7 +534,6 @@ - */ - function page_title_get_title($raw = FALSE, $flush = FALSE) { - $title = &drupal_static(__FUNCTION__); -- - if ($flush || is_null($title)) { - // Give other modules the oppertunity to use hook_page_title_alter(). - drupal_alter('page_title', $title); -@@ -600,22 +599,34 @@ - $title = &drupal_static(__FUNCTION__); - - if (is_null($title)) { -- $types = array('global' => NULL); - -- // Allow hook_page_title_pattern_alter() to modify the pattern and tokens -- drupal_alter('page_title_pattern', $page_title_pattern, $types); -+ // First case : try to get the custom title for the current page -+ $title = page_title_get_title(); - -- // If pattern is empty (either if the type is not overridable or simply not set) fallback to the default pattern -- if (empty($page_title_pattern)) { -- $settings = page_title_get_settings(); -- $page_title_pattern = variable_get('page_title_default', $settings['page_title_default']['default']); -- } -+ // If there is none, try to get the define pattern for the current page type (node type, etc ...) -+ if (empty($title)) { -+ $types = array('global' => NULL); -+ -+ // Allow hook_page_title_pattern_alter() to modify the pattern and tokens -+ drupal_alter('page_title_pattern', $page_title_pattern, $types); -+ -+ // If pattern is empty (either if the type is not overridable or simply not set) fallback to the default pattern -+ if (empty($page_title_pattern)) { -+ $settings = page_title_get_settings(); -+ $page_title_pattern = variable_get('page_title_default', $settings['page_title_default']['default']); -+ } - -- // Append the pattern for pages with a pager on them -- $page_title_pattern .= isset($_REQUEST['page']) ? variable_get('page_title_pager_pattern', '') : ''; -+ // Append the pattern for pages with a pager on them -+ $page_title_pattern .= isset($_REQUEST['page']) ? variable_get('page_title_pager_pattern', '') : ''; - -- // Apply token patterns using token_replace -- $title = token_replace($page_title_pattern, $types, array('sanitize' => FALSE)); -+ // Apply token patterns using token_replace -+ $title = token_replace($page_title_pattern, $types, array('sanitize' => FALSE)); -+ } -+ -+ // If there is still nothing, get the default title -+ if (empty($title)) { -+ page_title_default($title); -+ } - } - - // Trim trailing whitespace from the title diff -ruN ./page_title.tokens.inc ../page_title_updated/page_title.tokens.inc --- ./page_title.tokens.inc 2012-05-09 11:28:00.000000000 +0200 +++ ../page_title_updated/page_title.tokens.inc 2014-06-12 15:37:59.202809911 +0200 @@ -28,7 +28,7 @@ foreach ($tokens as $name => $original) { switch ($name) { case 'page-title': - $replacements[$original] = page_title_get_title(!$sanitize); + $replacements[$original] = drupal_get_title(); break; } }