Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Local tasks should be sorted by alphabet if they specifically don't have a weight set. The same as in Drupal 7.
Now, they are ordered the same as they are defined in modulename.local_tasks.yml.
Comment | File | Size | Author |
---|---|---|---|
#3 | loctal-tasks-sorting.patch | 942 bytes | Anonymous (not verified) |
Comments
Comment #1
alexpottComment #2
sunComment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedFirst I though that this should be done in \Drupal\Core\Menu\LocalTaskManager::getLocalTasksForRoute() but then I threw out the patch and thought that this is a UI thing so it should be done in /core\includes\menu\menu_local_tasks instead but maybe I'm wrong.
I don't like my solution though due to the fact that there are 'title' and 'weight' keys added and after sorting they are removed from the list. It certainly has to be done prettier than that, it's just a quick fix.
Comment #4
sunSorry, apparently I got terribly confused by @alexpott's reference in #1, which appears to be bogus?
This issue seems to be a simple/trivial bug fix and has nothing to do with changing the order of all declarations in YAML files.
→ Removing both issue relations for clarity.
Comment #6
dawehnerSorry but I really think we should not do that on the render level but rather in the local task manager itself ... one reason is that the alter hook should still have enough power to do whatever is needed.