• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How to Set the Selected NAV Button?

robdog

Well-known member
#1
I have created some external pages which work fine with custom blocks, breadcrumb, nav buttons. But when I go to a page that is routed to a nav button, it is not being styles as selected.

Here is the button setup:
$extraTabs['schedule'] = array(
'title' => new XenForo_Phrase('Schedule'),
'href' => XenForo_Link::buildPublicLink('full:en/schedule/'),
'selected' => ($selectedTabId == 'schedule'),
'position' => 'middle',
);

When extending the controllerPublic, do I set the selectedTabId there? Or should XenForo do this automatically?

Thanks.
 

Arik

Well-known member
#2
It's actually assigned within the route prefix class, in your match function. It's the third parameter passed to $router->getRouteMatch.
 

robdog

Well-known member
#3
SWEET this worked. And once I fixed this my breadcrumbs were created properly as well.

I am just checking things off the list today, GOOD TIMES!