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.
Problem/Motivation
menu_local_tabs() is not used in core it seems and LocalTasksBlock calls it directly.
Proposed resolution
Just deprecate it in favor of using the block or using the theme function directly.
Specifically, trigger errors for menu_local_tabs(), menu_secondary_local_tasks() and menu_primary_local_tasks(), and write a legacy test file for those functions along with menu_cache_clear_all() which is already triggering an error.
Remaining tasks
- Create CR
- Add the deprecation notice
- Add the legacy test
Comment | File | Size | Author |
---|---|---|---|
#22 | interdiff.3021718.17-22.txt | 944 bytes | mikelutz |
#22 | 3021718-22.drupal.Deprecate-menulocaltabs.patch | 4.83 KB | mikelutz |
Comments
Comment #2
andypostOnly one contrib using it http://grep.xnddx.ru/search?text=menu_local_tabs
Comment #3
andypostFiled CR https://www.drupal.org/node/3021778
Any idea how to extend deprecation test to make sure non empty array returned?
Comment #4
andyposta bit of clean-up
Comment #5
andypostComment #6
volegerThe simplest way is to convert
Kernel
test toFunctional
and usingdrupalGet
change the route context. For example, we can enable theuser
module and go to theuser.page
route that has local tasks, so in that route context will return non-empty array.Maybe its possible to do in Kernel test, but I have no idea for now.
Comment #7
anpolimus@andypost. I think that this branch needs reroll.
Current version of 8.7.x branch already has another comments sections.
For example:
https://cgit.drupalcode.org/drupal/tree/core/includes/menu.inc?h=8.7.x#n151
Could you, please, approve that I'm right?
Comment #8
glu2006 CreditAttribution: glu2006 at Skilld commentedPatch applies cleanly, no idea which comment changed.
Comment #9
volegerI tried to convert and update a test to make the function return a non-empty value. But without success. Function relies on routeMatch service and that service always returns
<none>
route name during the test. So maybe someone knows how to put the desired request into requestStack service to be able to define the current route that has related local tasks. That will help return a non-empty value.Comment #10
andypostI think we should not test all possible permutations cos goal of the test to be sure that deprecation fires
Comment #11
volegerIn that case, +1 for rtbc.
The legacy test has the call of the deprecated function and the other tests are green.
Comment #12
alexpottI think having another CR and not using https://www.drupal.org/node/2874695 is tricky - too many CRs are confusing. Since menu_primary_local_tasks() and menu_secondary_local_tasks() and menu_local_tabs() are all so linked. Let's:
Comment #13
andypostI did update old CR https://www.drupal.org/node/2874695 and have no rights to delete https://www.drupal.org/node/3021778
Comment #14
glu2006 CreditAttribution: glu2006 as a volunteer and at Skilld commentedaddress #12
Comment #15
andypostFix messages according #3024461: Adopt consistent deprecation format for core and contrib deprecation messages
Comment #17
BerdirThat needs an update now :)
Comment #18
andypostFixed again)
Updated CR
Comment #19
BerdirSee my comment in #3021823: Properly deprecate functions in menu.inc, should we include that last function/merge these two issues together?
Comment #21
andypostbot flux
Comment #22
mikelutzThe last function from the other issue already got it's @trigger_error in #2248983: Define the revision metadata base fields in the entity annotation in order for the storage to create them only in the revision table, It's just missing a legacy test. I think it's fine to include a test for that in this issue.
Comment #23
andypostAh the only one, then makes sense
Comment #24
catchCommitted e4b2539 and pushed to 8.8.x. Thanks!