Hi,
I was experimenting with Menu Multilingual module and the filtering capabilities this module provides seem to fulfill exactly what I need on my multilingual site.
I was also planning to use the Responsive and off-canvas menu module. This module allows you to choose which Drupal Menu is rendered in the blocks provided by it.
So basically what I would ultimately like to achieve is this:
- I have the standard Drupal Main Menu where I have all menu links
- I use the Responsive and off-canvas menu module to render the menu links. This provides two blocks.
- In the blocks provided by Responsive and off-canvas menu, I would like to filter the menu links based on the language with this module.
Currently, the multilingual options provided by this module only appear in the block configuration of the standard Drupal 8 menu blocks.
Feature request: support the filtering also for the blocks provided by the Responsive and off-canvas menu module.
Cheers,
Markus
Comments
Comment #2
masipila commentedOkay I was digging this a bit myself and I think I'm quite close.
The Responsive and off-canvas menu module provides two blocks. I tried to get the multilingual options provided by this module working with the first one.
The first block has plugin id 'responsive_menu_toggle'. The class for this is Drupal\responsive_menu\Plugin\Block\Toggle.
What I tried to do is that I created a class that extends the Toggle just like we have classes that extend SystemMenuBlock and MenuBlock:
To get this to appear on the block configuration form, I tried to modify the hook as follows:
But for some reason I'm still not able to see the multilingual options on the block configuration form... I know I'm really close but would appreciate if you could push me a over the line...
Cheers,
Markus
Comment #3
vlad.dancerHi, Markus. I think you should also implement this hook
hook_block_view_BASE_BLOCK_ID_alterlike:Comment #4
masipila commentedThanks! I'll give it a try during the weekend and provide a patch for the whole thing if I get it working!
Markus
Comment #5
masipila commentedHi,
I found out the reason why the fields do not appear in the block configuration form is this.
The
$multilingualform element has the#processcallback.The configuration fields are visible on Drupal\menu_multilingual\Plugin\Block\SystemMenuBlockMultilingual. This class extends Drupal\system\Plugin\Block\SystemMenuBlock, which has the processMenuLevelParents method which is used in the callback.
Now, when I look at Drupal\responsive_menu\Plugin\Block\Toggle, it extends Drupal\Core\Block\BlockBase which does not have the
processMenuLevelParentsmethod.I'll continue hacking this but wanted to drop a note here on what's going on.
Markus
Comment #6
masipila commentedI opened #2953911: Integrating with Menu Multilingual module to figure out if the block provided by responsive_menu could extend SystemMenuBlock instead of BlockBase.
Comment #7
masipila commentedIt seems that the responsive_menu module can't be easily integrated with menu_multilingual because the blocks are not prepared as SystemMenuBlocks but directly as BlockBase. See the comment at https://www.drupal.org/project/responsive_menu/issues/2953911#comment-12...
For other's that might come up to this issue: the hooks provided by responsive_menu allowed me to achieve what I needed without using menu_multilingual. I documented the approach I used to the handbook of responsive_menu: https://www.drupal.org/node/2681651#multilingual-sites
Closing this issue as WONTFIX.
Cheers,
Markus
Comment #8
matsbla commentedOkay cool, nice to see you found a solution!