summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2015-10-10 19:52:22 -0400
committerDavid Rothstein <drothstein@gmail.com>2015-10-10 19:52:22 -0400
commitf7548361a664b6cb2fffc4e23a2a1a6620addd80 (patch)
tree04220dc506c80ff92525742dce9c501b147eede8 /includes
parentd488eb129f4d65334ed999d12012ea8380992248 (diff)
downloadbrdo-f7548361a664b6cb2fffc4e23a2a1a6620addd80.tar.gz
brdo-f7548361a664b6cb2fffc4e23a2a1a6620addd80.tar.bz2
Issue #1973262 by cilefen, Matt V., David_Rothstein, Anybody, Rob230: User pages display incorrect title instead of "Menu link title" when link paths are added to a default menus
Diffstat (limited to 'includes')
-rw-r--r--includes/menu.inc24
1 files changed, 22 insertions, 2 deletions
diff --git a/includes/menu.inc b/includes/menu.inc
index 0e9c977c6..eb623a936 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -2613,10 +2613,30 @@ function menu_get_active_breadcrumb() {
*/
function menu_get_active_title() {
$active_trail = menu_get_active_trail();
+ $local_task_title = NULL;
foreach (array_reverse($active_trail) as $item) {
- if (!(bool) ($item['type'] & MENU_IS_LOCAL_TASK)) {
- return $item['title'];
+ // Local task titles are displayed as tabs and therefore should not be
+ // repeated as the page title. However, if the local task appears in a
+ // top-level menu, it is no longer a "local task" anymore (the front page
+ // of the site does not have tabs) so it is better to use the local task
+ // title in that case than to fall back on the front page link in the
+ // active trail (which is usually "Home" and would not make sense in this
+ // context).
+ if ((bool) ($item['type'] & MENU_IS_LOCAL_TASK)) {
+ // A local task title is being skipped; track it in case it needs to be
+ // used later.
+ $local_task_title = $item['title'];
+ }
+ else {
+ // This is not a local task, so use it for the page title (unless the
+ // conditions described above are met).
+ if (isset($local_task_title) && isset($item['href']) && $item['href'] == '<front>') {
+ return $local_task_title;
+ }
+ else {
+ return $item['title'];
+ }
}
}
}