Generalize MenuLinkAdd so all local actions can use it

Created on 7 July 2016, over 8 years ago
Updated 6 February 2023, about 2 years ago

So when defining a local action, you may specify a class to dynamically set some properties. A common use case is to slap on a 'destination' query parameter so people are redirected to the page the action was on after performing the action itself.

The menu_ui module already provides a class that does exactly that: \Drupal\menu_ui\Plugin\Menu\LocalAction\MenuLinkAdd. Why don't we generalize this class to core to something like: Drupal\Core\Menu\LocalActionWithDestination?

That way, all modules can use it without having to rely on menu_ui being enabled or having to duplicate the code.

✨ Feature request
Status

Needs work

Version

10.1 ✨

Component
Menu systemΒ  β†’

Last updated 2 days ago

Created by

πŸ‡§πŸ‡ͺBelgium kristiaanvandeneynde Antwerp, Belgium

Live updates comments and jobs are added and updated live.
  • Needs change record

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request β†’ as a guide.

    Maybe it's just me but if changing the class name couldn't that break existing sites?
    If so we would need a different approach, maybe we deprecate the old

    If not still think this could use a change record.

  • First commit to issue fork.
  • Merge request !10366Resolve #2762131 "Generalize menulinkadd" β†’ (Open) created by tstoeckler
  • πŸ‡©πŸ‡ͺGermany tstoeckler Essen, Germany

    If so we would need a different approach, maybe we deprecate the old

    I don't understand, that's exactly what the patch does.

    Added a draft change notice and converted to merge request.

  • Pipeline finished with Failed
    4 months ago
    Total: 525s
    #352127
  • Pipeline finished with Canceled
    4 months ago
    Total: 125s
    #352913
  • Pipeline finished with Success
    4 months ago
    Total: 712s
    #352914
  • πŸ‡©πŸ‡ͺGermany tstoeckler Essen, Germany

    There was an issue in #32 in how getAsArray() was used, that is fixed now and, thus, the tests are green again. Good to go from my point of view.

  • Pipeline finished with Success
    4 months ago
    Total: 545s
    #352985
  • πŸ‡§πŸ‡ͺBelgium kristiaanvandeneynde Antwerp, Belgium

    Don't agree with #18.1, but other than that changes look good minus some tiny things. Left notes. Thanks for converting this @tstoeckler!

  • πŸ‡©πŸ‡ͺGermany tstoeckler Essen, Germany

    Thanks for the review, fixed all the things now (hopefully).

  • πŸ‡§πŸ‡ͺBelgium kristiaanvandeneynde Antwerp, Belgium

    LGTM now. As I said before, I don't think we need \Drupal\Core\Routing\RedirectDestination::getAsArray() here because AFAIAC it doesn't make sense in this context.

    I saw one seemingly random test failure, so running that one again. Can RTBC if that one goes green.

  • Pipeline finished with Success
    4 months ago
    Total: 3383s
    #353078
  • πŸ‡§πŸ‡ͺBelgium kristiaanvandeneynde Antwerp, Belgium

    All green now.

    Saving credit for Tobias, might remove some credit for broken patches but asking internally first.

  • πŸ‡§πŸ‡ͺBelgium kristiaanvandeneynde Antwerp, Belgium
    • Hid all patches as we switched to MR
    • Saved credit for the code contributions, leaving credit for reviews to the core committer
    • Removed credit for comments that only uploaded broken patches
    • On the fence about #29 as it's a tiny change but kept credit for now as it was to some extent impactful
    • Will also update CR to be a bit more informative
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    Read the IS, comments, the MR and the Change record. For the MR, a change was requested by larowlan, which has not happened. It is explained in the comments in the MR but that should have another check, it is at https://git.drupalcode.org/project/drupal/-/merge_requests/10366#note_41.... The other was the change record which I edited to focus on the impact and what sites need to do. I put the 'what is changed' at the top, followed by the action sites may need to take. and removed bits explaining how the deprecation is done.

    I also updated credit.

  • First commit to issue fork.
  • πŸ‡¬πŸ‡§United Kingdom oily Greater London

    Filled out the issue summary template.

  • πŸ‡¬πŸ‡§United Kingdom oily Greater London

    Added one code comment/ recommendation to the MR.

  • Status changed to RTBC about 2 months ago
  • πŸ‡§πŸ‡ͺBelgium kristiaanvandeneynde Antwerp, Belgium

    Added to the discussion regarding the wording of a test case, but don't think that warrants removing RTBC. A committer an choose between the current docs and the ones suggested on commit.

  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Committed b2205af and pushed to 11.x. Thanks!

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

Production build 0.71.5 2024