- 🇺🇸United States j.cowher
Last patch was generated incorrectly and was missing files.
- last update
about 1 year ago Patch Failed to Apply - last update
about 1 year ago Patch Failed to Apply - 🇨🇦Canada gwvoigt London, ON 🇨🇦
Fixing my previous patch, to be used with D10
- last update
about 1 year ago Custom Commands Failed - last update
about 1 year ago Patch Failed to Apply - First commit to issue fork.
- Merge request !8931Issue #3091246: Allow MenuLinkTree manipulators to be altered → (Open) created by acbramley
- Status changed to Needs review
5 months ago 12:44am 26 July 2024 - 🇦🇺Australia acbramley
I've rolled ##24 onto an MR and updated the event dispatcher based on https://www.drupal.org/node/3376090 →
This was set to NW all the way back in #7 so I think this may be ready for another review.
The main thing I'm interested in is allowing menu links to have their cacheable metadata refined (i.e adding RefinableCacheableDependencyTrait to MenuLinkBase).
- Status changed to Needs work
5 months ago 12:44am 26 July 2024 The Needs Review Queue Bot → tested this issue.
While you are making the above changes, we recommend that you convert this patch to a merge request → . Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)
- Status changed to Needs review
5 months ago 12:58am 26 July 2024 - Status changed to Needs work
5 months ago 4:03pm 28 July 2024 - 🇺🇸United States smustgrave
Appears to have test failures
core/lib/Drupal/Core/Menu/MenuLinkBase.php
will the removed functions have to be deprecated? - Status changed to Needs review
5 months ago 11:55pm 28 July 2024 - 🇦🇺Australia acbramley
core/lib/Drupal/Core/Menu/MenuLinkBase.php will the removed functions have to be deprecated?
No, they are provided by the trait that's added instead.Failures should be fixed with latest commit.
- Status changed to Needs work
5 months ago 1:17pm 1 August 2024 - 🇺🇸United States smustgrave
Left 2 more small comments, will keep an eye out for this one.
- 🇦🇺Australia acbramley
Resolved the comments and also applied similar changes to the rest of the new files. Also removed the reference from getManipulators as we don't need that when we have a setter.
- 🇧🇪Belgium kriboogh
Failing tests due to https://www.drupal.org/project/drupal/issues/3041318 →
- 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
The event does not alters the manipulators array, help!
$this->eventDispatcher->dispatch(new MenuLinkTreeManipulatorsAlterEvent($tree, $manipulators, $this), MenuLinkTreeEvents::ALTER_MANIPULATORS); foreach ($manipulators as $manipulator) { $callable = $this->callableResolver->getCallableFromDefinition($manipulator['callable']);
My subscriber:
/** * React to manipulators alter event. */ public function manipulatorsAlter(MenuLinkTreeManipulatorsAlterEvent $event) { $manipulators = $event->getManipulators(); if (!empty($manipulators)) { array_unshift($manipulators, ['callable' => 'translatable_menu_link_uri.alter_links:alterMenuLinksManipulator']); } else { $manipulators = [['callable' => 'translatable_menu_link_uri.alter_links:alterMenuLinksManipulator']]; } $event->setManipulators($manipulators); }
Maybe the array should be by reference?
- 🇪🇸Spain tunic Madrid
I would say
$this->eventDispatcher->dispatch(new MenuLinkTreeManipulatorsAlterEvent($tree, $manipulators, $this), MenuLinkTreeEvents::ALTER_MANIPULATORS); foreach ($manipulators as $manipulator) { $callable = $this->callableResolver->getCallableFromDefinition($manipulator['callable']);
should be:
$event = new MenuLinkTreeManipulatorsAlterEvent($tree, $manipulators, $this); $this->eventDispatcher->dispatch($event, MenuLinkTreeEvents::ALTER_MANIPULATORS); foreach ($event->getManipulators() as $manipulator) { $callable = $this->callableResolver->getCallableFromDefinition($manipulator['callable']);
The $manipulators array is not changed during dispatch because arrays are copied when assigned, so a call to setManipulators inside a subscriber changes the array inside the $event but not the original $manipulators array used to create the instance of $event.
- 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
We are using 10.2.7, we are not sure, if Drupal 11 treats arrays in a different way, but the @tunic comment seems to be logical.
- 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
The change proposed by @tunic works for as on Drupal 10.2.7
- 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
Tests are failing https://git.drupalcode.org/issue/drupal-3091246/-/jobs/2307611
The manipulator is not applying
There was 1 failure: 1) Drupal\KernelTests\Core\Menu\MenuLinkTreeTest::testMenuManipulatorAlter Failed asserting that an array contains 'menu-test-link'. /builds/issue/drupal-3091246/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php:220
- 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
Here came the regression, the references were removed on commit https://git.drupalcode.org/project/drupal/-/commit/552c484ad403a37e93056...
- 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
Failed Javascript tests https://git.drupalcode.org/issue/drupal-3091246/-/pipelines/275582
- Status changed to Needs review
4 months ago 11:24am 6 September 2024 - Status changed to Needs work
4 months ago 2:33pm 6 September 2024 - 🇫🇮Finland tuutti
The current implementation in 🐛 Untranslated menu items are displayed in menus Needs work is very similar to this
- 🇦🇺Australia mstrelan
Opened ✨ Make it easier to decorate menu.default_tree_manipulators Active which proposes another method of decorating manipulators.