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
219
Merge Requests
219
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
c2d9dfca
Commit
c2d9dfca
authored
Oct 08, 2013
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2100651
by dawehner, neclimdul: Fixed local task plugin id check for derivatives.
parent
e9843f49
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
core/lib/Drupal/Core/Menu/LocalTaskDefault.php
core/lib/Drupal/Core/Menu/LocalTaskDefault.php
+1
-1
core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php
core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php
+17
-3
No files found.
core/lib/Drupal/Core/Menu/LocalTaskDefault.php
View file @
c2d9dfca
...
...
@@ -88,7 +88,7 @@ public function getTitle() {
public
function
getWeight
()
{
// By default the weight is 0, or -10 for the root tab.
if
(
!
isset
(
$this
->
pluginDefinition
[
'weight'
]))
{
if
(
$this
->
pluginDefinition
[
'tab_root_id'
]
==
$this
->
plugin
Definition
[
'id'
]
)
{
if
(
$this
->
pluginDefinition
[
'tab_root_id'
]
==
$this
->
plugin
Id
)
{
$this
->
pluginDefinition
[
'weight'
]
=
-
10
;
}
else
{
...
...
core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php
View file @
c2d9dfca
...
...
@@ -191,21 +191,34 @@ public function testGetRouteParametersForDynamicRouteWithUpcastedParameters() {
*/
public
function
providerTestGetWeight
()
{
return
array
(
array
(
array
(
'weight'
=>
314
),
314
),
// Manually specify a weight, so this is used.
array
(
array
(
'weight'
=>
314
),
'test_id'
,
314
),
// Ensure that a default tab get a lower weight.
array
(
array
(
'tab_root_id'
=>
'local_task_default'
,
'id'
=>
'local_task_default'
),
'local_task_default'
,
-
10
),
// If the root ID is different to the ID of the tab, ignore it.
array
(
array
(
'tab_root_id'
=>
'local_task_example'
,
'id'
=>
'local_task_default'
),
0
'local_task_default'
,
0
,
),
// Ensure that a default tab of a derivative gets the default value.
array
(
array
(
'tab_root_id'
=>
'local_task_derivative_default:example_id'
,
'id'
=>
'local_task_derivative_default'
),
'local_task_derivative_default:example_id'
,
-
10
,
),
);
}
...
...
@@ -217,8 +230,9 @@ public function providerTestGetWeight() {
*
* @see \Drupal\Core\Menu\LocalTaskDefault::getWeight()
*/
public
function
testGetWeight
(
array
$plugin_definition
,
$expected_weight
)
{
public
function
testGetWeight
(
array
$plugin_definition
,
$
plugin_id
,
$
expected_weight
)
{
$this
->
pluginDefinition
=
$plugin_definition
;
$this
->
pluginId
=
$plugin_id
;
$this
->
setupLocalTaskDefault
();
$this
->
assertEquals
(
$expected_weight
,
$this
->
localTaskBase
->
getWeight
());
...
...
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