Code Event Listeners cancelling each other out?

Mikey

Well-known member
I have two code event listeners for two different add ons, one seems to cancel the other out?

Both listen to "navigation_tabs" and look pretty much the same.

PHP:
public static function addNavbarTab(array & $extraTabs, $selectedTabId)
{
$options = XenForo_Application::get('options');
   if ($options->AddOnTabEnabled) {
      $extraTabs['info'] = array(
         'title' => new XenForo_Phrase('AddOn_NavTab_TabName'),
         'linksTemplate' => 'AddOn_NavTab_TabMenu',
         'href' => XenForo_Link::buildPublicLink('addon'),
         'position' => $options->AddOnNavTabPosition
      );
   }
}

At first I thought it was because both have the same function name (addNavbarTab) so I changed them to addAddOnNavbarTab, but still no dice.

Am I doing something wrong? Why would one cancel the other out?

Sorry for the influx of questions, btw.
 
Do they both set $extraTabs['info'] ?

The only thing I can think of is that you are using 'info' as the key in both add-ons, when they key must be unique per tab.
 
The only reason I can see this happening if is both are using 'info' as the key in the $extraTabs array. If that's the case, the last one will overwrite the first.
 
Do they both set $extraTabs['info'] ?

The only thing I can think of is that you are using 'info' as the key in both add-ons, when they key must be unique per tab.
The only reason I can see this happening if is both are using 'info' as the key in the $extraTabs array. If that's the case, the last one will overwrite the first.

Yes, they both use 'info'. Doh! My bad. Changed them and they work now! Thanks again guys
 
Do they both set $extraTabs['info'] ?

The only thing I can think of is that you are using 'info' as the key in both add-ons, when they key must be unique per tab.
Ha had the same problem :P thanks man
 
Top Bottom