Issue #2159471 by dawehner: Ordering of local tasks is arbitrary for derivative-based tasks of the same weight.
parent
bb78e06d83
commit
ce8541b281
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue