Issue #2159471 by dawehner: Ordering of local tasks is arbitrary for derivative-based tasks of the same weight.

8.0.x
Alex Pott 2014-04-06 22:00:40 +01:00
parent bb78e06d83
commit ce8541b281
2 changed files with 24 additions and 1 deletions

View File

@ -168,6 +168,23 @@ class LocalTaskManager extends DefaultPluginManager {
return call_user_func_array($controller, $arguments);
}
/**
* {@inheritdoc}
*/
public function getDefinitions() {
$definitions = parent::getDefinitions();
$count = 0;
foreach ($definitions as &$definition) {
if (isset($definition['weight'])) {
// Add some micro weight.
$definition['weight'] += ($count++) * 1e-6;
}
}
return $definitions;
}
/**
* Find all local tasks that appear on a named route.
*

View File

@ -394,7 +394,7 @@ class LocalTaskManagerTest extends UnitTestCase {
*/
protected function getLocalTasksCache() {
$local_task_fixtures = $this->getLocalTaskFixtures();
return array(
$local_tasks = array(
'base_routes' => array(
'menu_local_task_test_tasks_view' => 'menu_local_task_test_tasks_view',
),
@ -414,6 +414,12 @@ class LocalTaskManagerTest extends UnitTestCase {
),
),
);
$local_tasks['children']['> menu_local_task_test_tasks_view']['menu_local_task_test_tasks_settings']['weight'] = 0;
$local_tasks['children']['> menu_local_task_test_tasks_view']['menu_local_task_test_tasks_edit']['weight'] = 20 + 1e-6;
$local_tasks['children']['> menu_local_task_test_tasks_view']['menu_local_task_test_tasks_view.tab']['weight'] = 2e-6;
$local_tasks['children']['menu_local_task_test_tasks_view.tab']['menu_local_task_test_tasks_view_child1']['weight'] = 3e-6;
$local_tasks['children']['menu_local_task_test_tasks_view.tab']['menu_local_task_test_tasks_view_child2']['weight'] = 4e-6;
return $local_tasks;
}
}