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
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

voleger created an issue. See original summary.

andypost’s picture

andypost’s picture

Status: Active » Needs review
FileSize
1.79 KB

Filed CR https://www.drupal.org/node/3021778

Any idea how to extend deprecation test to make sure non empty array returned?

andypost’s picture

a bit of clean-up

andypost’s picture

Issue tags: +Kill includes
voleger’s picture

Any idea how to extend deprecation test to make sure non empty array returned?

The simplest way is to convert Kernel test to Functional and using drupalGet change the route context. For example, we can enable the user module and go to the user.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.

anpolimus’s picture

@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?

glu2006’s picture

Patch applies cleanly, no idea which comment changed.

voleger’s picture

I 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.

andypost’s picture

I think we should not test all possible permutations cos goal of the test to be sure that deprecation fires

voleger’s picture

Status: Needs review » Reviewed & tested by the community

In that case, +1 for rtbc.
The legacy test has the call of the deprecated function and the other tests are green.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

I 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:

  1. Add this issue to https://www.drupal.org/node/2874695
  2. Add @trigger_error() to menu_primary_local_tasks() and menu_secondary_local_tasks()
  3. Add assertions for the new @trigger_error()'s to the test.
  4. Delete https://www.drupal.org/node/3021778
andypost’s picture

I did update old CR https://www.drupal.org/node/2874695 and have no rights to delete https://www.drupal.org/node/3021778

glu2006’s picture

Status: Needs work » Needs review
FileSize
4.05 KB
4.17 KB

address #12

andypost’s picture

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Berdir’s picture

Status: Needs review » Needs work

That needs an update now :)

andypost’s picture

Status: Needs work » Needs review
FileSize
5.74 KB
4.33 KB

Fixed again)
Updated CR

Berdir’s picture

See my comment in #3021823: Properly deprecate functions in menu.inc, should we include that last function/merge these two issues together?

Status: Needs review » Needs work

The last submitted patch, 18: 3021718-18.patch, failed testing. View results

andypost’s picture

Status: Needs work » Needs review

bot flux

mikelutz’s picture

Title: Deprecate menu_local_tabs() » Properly deprecate menu_local_tabs(), menu_secondary_local_tasks(), menu_primary_local_tasks()
Issue summary: View changes
FileSize
4.83 KB
944 bytes

The 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.

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Ah the only one, then makes sense

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed e4b2539 and pushed to 8.8.x. Thanks!

  • catch committed e4b2539 on 8.8.x
    Issue #3021718 by andypost, glu2006, mikelutz, voleger, alexpott:...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.