Closed soullivaneuh closed 6 years ago
so, you actually inject the MenuProvider inside one of your menu builder ? I never thought about such use case. I would be interested to learn more about it
I have to copy the profile menu on the sidebar menu for the mobile view:
// Copy the profile menu for mobile view.
foreach ($this->menuProvider->get('profile')->getChildren() as $profileChild) {
$menu->addChild($profileChild->copy()->setAttribute('class', 'visible-xs-block'));
}
I'm not sure it's the best way to do but it's the only valid way I found so far.
What I did for similar case was either to put both menus in the same builder class (and using private methods for the common logic), or injecting a specific menu builder object inside my other builder and calling its method on it.
Well, it's a solution indeed, but the sidebar builder is enough large like that! :-D
In any case, having an autowiring solution here can be a useful thing. Plus, the "generic" service already exists.
well, injecting my own service into the other service works with autowiring :smile:
But anyway, I'm OK with adding such autowiring. Can you send a PR ?
Current error:
Current workaround: