Commit ce8541b2 authored by alexpott's avatar alexpott

Issue #2159471 by dawehner: Ordering of local tasks is arbitrary for...

Issue #2159471 by dawehner: Ordering of local tasks is arbitrary for derivative-based tasks of the same weight.
parent bb78e06d
......@@ -168,6 +168,23 @@ public function getTitle(LocalTaskInterface $local_task) {
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 @@ protected function getLocalTasksForRouteResult($mock_plugin) {
*/
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 @@ protected function getLocalTasksCache() {
),
),
);
$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;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment