Hello,
it is impossible for me to install the module, it throws :
TypeError: Argument 5 passed to Drupal\menu_position\Menu\MenuPositionActiveTrail::__construct() must be an instance of Drupal\Core\Entity\Query\QueryFactory, instance of Drupal\context\ContextManager given, called in /var/www/local.dev/my-website/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 286 in Drupal\menu_position\Menu\MenuPositionActiveTrail->__construct() (line 37 of modules/contrib/menu_position/src/Menu/MenuPositionActiveTrail.php).
Has someone experienced same issue ?
Many thanks for the advices.
Comment | File | Size | Author |
---|---|---|---|
#3 | menu-position-2944480-3.patch | 1.92 KB | Etroid |
Comments
Comment #2
Janez Zibelnik CreditAttribution: Janez Zibelnik at Agiledrop - Your Trusted Drupal Teammates commentedContext and Menu Position modules both have the same functionality of setting the active menu item on certain condition. In order to achieve that functionality, they both make changes to the core menu.active_trail service by adding different objects to the service constructor. The first in order is Context module that sets the context.manager in the active_trail service constructor and by the time Menu position does the same by trying to add entity.query service to index 4 of the constructor the active_trail is already set to expect a different kind of object on that index of the constructor. This explains the error message.
The solution depends on your use case:
1. If you use menu_position module to set the active menu item based on some conditions than the same functionality can be achieved by the context module itself, so you can remove the menu_position module.
2. If on the other hand, you use menu_position module to add the current page to the menu than I am afraid context module doesn't ship with this specific reaction. And using both modules at the same time isn't possible.
Comment #3
Etroid CreditAttribution: Etroid commentedWhile we prefer menu_position for setting active trail, we would still like to use all the other features that context has to offer. I suggest adding a condition around overwriting the menu.active_trail service to avoid collision when menu_position module is enabled:
Then we can also hook into the available context reactions and disable menu:
Comment #4
Etroid CreditAttribution: Etroid commentedComment #5
strozx CreditAttribution: strozx commentedI have installed the menu_postion module and then the context module and the installation was successful. I have also checked for the disabled menu in the reactions section.
Comment #6
sense-design#3 works good and fixes the error.
Comment #7
soothmidas CreditAttribution: soothmidas as a volunteer commentedNot the same issue but related... if you are using the Menu Trail by Path module and install/enable Context the same core issue happens. The patch found in this thread fixed it for me: https://www.drupal.org/project/menu_trail_by_path/issues/2914746#comment...
Comment #8
criscom#3 works for me. Thanks.
Comment #9
paulocsThis patch is specific for when Menu Position module is installed.
What we need is a general patch for when a module overrides the menu.active_trail, the context module will not break the site after it is installed.
I created a patch to a general approach in issue #3018331: Install fails if module Menu Trail by Path is installed.
Maybe you can review the patch there.
Cheers, Paulo.
Comment #10
paulocsThis issue was fixed in #3018331: Install fails if module Menu Trail by Path is installed.
It was created a general approach for it. When another module overrides the menu.active_trail, the menu reaction will not break the web site.
Thanks.