XF 2.3 .is-selected, how to?

Old Nick

Well-known member
I made a custom menu, and I would like when I click on one of the menu links and land on the page the link is in bold. I'm tinkering with some syntax stolen from the members menu but I can't adapt it to my configuration.

What should I replace XXXXXXX with for it to work?
HTML:
<a href="/documents/?prefix_id=4" class="blockLink {{ $pageSelected == 'XXXXXXX' ? 'is-selected' : '' }}">Menu A</a>

In extra.less
Less:
[data-widget-key="resource_filter"] {
    a.blockLink.is-selected {
        font-weight: 700;
    }
}

Each link in the menu points to a page of resources sorted by prefix.
Thanks
 
Solution
That's just a regular variable set in the templates that becomes available in the wrapper, it's not available globally. You'd have to find some other condition to match on.

You can {{ dump(vars()) }} to see what's available, and if it's not already present you could grab the prefix ID via $xf.request.filter('prefix_id', 'int').
That's just a regular variable set in the templates that becomes available in the wrapper, it's not available globally. You'd have to find some other condition to match on.

You can {{ dump(vars()) }} to see what's available, and if it's not already present you could grab the prefix ID via $xf.request.filter('prefix_id', 'int').
 
Solution
That works so well! Thank you very much.
HTML:
<a href="/resources/?prefix_id=4" class="blockLink {{ $xf.request.filter('prefix_id', 'int') == '4' ? 'is-selected' : '' }}">Menu 4</a>
 
Back
Top Bottom