- Issue created by @gnuschichten
- 🇩🇪Germany gnuschichten
A solution in the frontend would be an attribute selector, like [href ~="foo"]
Since the url is the same in all languages. But that's not elegant. Twig filters don't work here and are not a good solution.
{{ url | split('/') | last }}
I think this should be solved via a variable in the module if you don't want me to throw javascript on it. :)
- 🇫🇷France nicolasgraph Strasbourg
Not sure that's the best way to do but I was able to locally fix the issue by replacing
toolbar-link--{{item.title|clean_class }}
bytoolbar-link--{{item.title.getUntranslatedString()|clean_class }}
in templates. - 🇫🇷France nicolasgraph Strasbourg
Here is the patch I talked previously, however, in my case,
.getUntranslatedString()
returnsNULL
for some links title, so in fact some icons are still missing. Falling back to the title works for a few of them, but still not ideal. - 🇫🇷France pbonnefoi
@NicolasGraph I tried the patch but some icons are still missing (using french language)
- First commit to issue fork.
- @saschaeggi opened merge request.
- Status changed to Needs review
about 1 year ago 9:50am 20 October 2023 - Status changed to Needs work
about 1 year ago 10:41am 20 October 2023 - 🇨🇭Switzerland saschaeggi Zurich
We'll need to add safe classes maybe based on the item id in
getNavigationAdminMenuItems()
to expose them to the twig template. - Status changed to Needs review
about 1 year ago 11:43am 20 October 2023 - 🇨🇭Switzerland saschaeggi Zurich
Added the class to content menus. This needs another review :)
- 🇫🇷France pbonnefoi
@saschaeggi I saw your commit but that did not solve the translation issue. In my last commit I changed to use the routing instead of the title to create the class. It's less likely to change than a title I think so more robust (despite having not so beautiful classes). I also made changes on Create and Content navigation to make it consistent.
Works fine on my version (But still having sprite issues for some reasons, but I think that is another problem).I might find a better solution later with creating a custom manipulator. It's funny I saw an interesting solution on my own question asked on Stackexchange posted 7 years ago :-D (https://drupal.stackexchange.com/questions/201903/programmatically-get-m...)
Anyway, let me know what you think and if I can help on other things.
- Assigned to pbonnefoi
- 🇫🇷France nicolasgraph Strasbourg
This seems a quite good approach to me and it does work on a fresh install of mine.
I'm just wondering: why to use a twig filter to build and clean the class instead of just doing it properly in the GinNavigation service ? - Issue was unassigned.
- 🇨🇭Switzerland saschaeggi Zurich
@NicolasGraph @pbonnefoi I've pushed a change where we add the pluginId as class in php instead.
This should now be ready for a review.
- Status changed to RTBC
about 1 year ago 9:28am 21 October 2023 - 🇫🇷France nicolasgraph Strasbourg
I suggested a comment update ; otherwise, it seems good enough to me to go forward.
Thank you both! - Status changed to Fixed
about 1 year ago 10:10am 21 October 2023 Automatically closed - issue fixed for 2 weeks with no activity.