Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
228
Merge Requests
228
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
820f4eb8
Commit
820f4eb8
authored
Aug 01, 2012
by
catch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1564388
by anrikun, sun: Fixed 'My account' link is never in the active trail.
parent
ac0708ae
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
7 deletions
+15
-7
core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
...es/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
+4
-1
core/modules/user/user.module
core/modules/user/user.module
+11
-6
No files found.
core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
View file @
820f4eb8
...
...
@@ -407,7 +407,10 @@ function testBreadCrumbs() {
$trail
+=
array
(
'user/'
.
$this
->
web_user
->
uid
=>
$this
->
web_user
->
name
,
);
$this
->
assertBreadcrumb
(
'user/'
.
$this
->
web_user
->
uid
.
'/edit'
,
$trail
,
$this
->
web_user
->
name
);
$tree
=
array
(
'user'
=>
t
(
'My account'
),
);
$this
->
assertBreadcrumb
(
'user/'
.
$this
->
web_user
->
uid
.
'/edit'
,
$trail
,
$this
->
web_user
->
name
,
$tree
);
// Add a Navigation menu links for 'user' and $this->admin_user.
// Although it may be faster to manage these links via low-level API
...
...
core/modules/user/user.module
View file @
820f4eb8
...
...
@@ -1623,12 +1623,6 @@ function user_menu() {
'page arguments'
=>
array
(
1
),
'access callback'
=>
'user_view_access'
,
'access arguments'
=>
array
(
1
),
// By assigning a different menu name, this item (and all registered child
// paths) are no longer considered as children of 'user'. When accessing the
// user account pages, the preferred menu link that is used to build the
// active trail (breadcrumb) will be found in this menu (unless there is
// more specific link), so the link to 'user' will not be in the breadcrumb.
'menu_name'
=>
'navigation'
,
);
$items
[
'user/%user/view'
]
=
array
(
...
...
@@ -1728,6 +1722,17 @@ function user_menu_link_alter(&$link) {
}
}
/**
* Implements hook_menu_breadcrumb_alter().
*/
function
user_menu_breadcrumb_alter
(
&
$active_trail
,
$item
)
{
// Remove "My account" from the breadcrumb when $item is descendant-or-self
// of system path user/%.
if
(
isset
(
$active_trail
[
1
][
'module'
])
&&
$active_trail
[
1
][
'module'
]
==
'system'
&&
$active_trail
[
1
][
'link_path'
]
==
'user'
&&
strpos
(
$item
[
'path'
],
'user/%'
)
===
0
)
{
array_splice
(
$active_trail
,
1
,
1
);
}
}
/**
* Implements hook_translated_menu_link_alter().
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment