Open perifer opened 8 years ago
In what way do you want to change the markup? We could add a filter, but might prefer to improve the markup itself too.
In this specific case this is our ideal markup (we are adding a header before the menu, note aria-labelledby="sidebar-menu-headline"
which is added to nav
):
<h2 id="sidebar-menu-headline" class="sidebar-menu__headline"><span class="visually-hidden">Undernavigation för </span>{{ $ancestor }}</h2>
<nav id="sidebar-menu" aria-labelledby="sidebar-menu-headline">
<ul class="nav-aside hidden-xs hidden-sm">
{{ $menu }}
</ul>
</nav>
The most logical place to change this would to me would be in sidebar-left.blade.php
or a new blade partial. I feel that there is more places like this through out Municipio that could benefit from having HTML-code in partials instead of in PHP functions.
A new example is in Municipio\Theme\Navigation::addSearchMagnifier() where we would like to remove pricon and alter classes.
Please feel free to provide us with solution examples trough a PR. Ideally we should use blade engine in most cases.
Cool. I actually looked through some of your source code to see if I could find any examples of Class methods using blade to render HTML, but didn't find anything. I'll see if I can look at this some more.
You may do something like this function to fetch a template: https://github.com/helsingborg-stad/Municipio/blob/master/library/Template.php#L98
Municipio\Helper\Navigation::sidebarMenuAuto() contains HTML that we would like to alter:
It would be nice if that would be easier to do. Currently the only way to do it seems to be to replace sidebarMenuAuto() with our own function but it contains a lot of other logic which is a shame to duplicate.