- πΊπΈUnited States rs3876
I have Drupal 9.5.9, Group 8.x-1.5 and Groupmenu 8.x-1.0-beta3
Groupmenu is not showing. I tried the following lines without any luck.
--------------- code -------------------
$block_manager = \Drupal::service('plugin.manager.block');
$plugin_block = $block_manager->createInstance('groupmenus');
$plugin_block->setContextValue('group', $group);
$block = $plugin_block->build();
-------------------------------------------
Error I get when using setContextValue() in above code.
---------------- Error----------------------
Uncaught PHP Exception Drupal\Component\Plugin\Exception\ContextException: "The group context is not a valid context." at \web\core\lib\Drupal\Core\Plugin\ContextAwarePluginTrait.php line 184
---------------------------------------------I also tried 2 patches following patches mentioned in above comment #7. I had to make changes to make patch 1 compatible with D-9.
---------------------- Patches-------------------
patch 1 - https://www.drupal.org/files/issues/2018-08-28/group-configurable-entiti... β
patch 2- https://www.drupal.org/files/issues/2019-04-04/groupmenu-change_referenc... β
---------------------------------------------------Not sure if I am on right path. Looking for help.
- πΊπΈUnited States ao5357
As a note, I applied similar changes to these patches in the issue fork for https://www.drupal.org/project/groupmenu/issues/3351701 π Group menu compatibility with group V2 and V3 Needs review and was able to get the menu tree to appear in that fork per #7 .
The trick, at least in the issue fork, was to switch $menu_name to $menu->id() in the build() method's foreach loop, where it loads the menuTree(s). See https://git.drupalcode.org/issue/groupmenu-3351701/-/blob/3351701-group-...