- Issue created by @_renify_
I'm having issue on setting attributes if the menu has sub menu
Ex.
function hook_preprocess_menu(&$variables) {
$items = &$variables['items'];
foreach ($items as $key => &$item) {
if ($item is Child Menu A) {
$item['attributes']->setAttribute('class', ['custom-class']);
}
}
}
i would expect that menu should be <a href="/path/to/link" class="expanded level4 custom-class" >Child Menu A</a>
but it turns out <a href="/path/to/link" class="expanded level4" >Child Menu A</a>
Create something like this & enable Show as expanded.
Main Menu A
-- Child Menu A
----Sub Menu A
----Sub Menu B
----Sub Menu C
Main Menu B
Active
10.0 β¨