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

Can't Create Code Event Listener

Jaxel

Well-known member
#1
I created an addon with the id "8wrXenPorta".

Then I created a file in library/8wrXenPorta/listeners.php
Code:
<?php

class 8wrXenPorta_Listeners
{
	public static function navtabs(array &$extraTabs, $selectedTabId)
	{
		$extraTabs['8wrXenPorta'] = array(
			'title' => 'XenPorta',
			'href' => 'XenPorta',
			'selected' => ($selectedTabId == '8wrXenPorta'),
			'linksTemplate' => '',
		);
	}
}
Then I tried to create a Code Event Listener with 8wrXenPorta_Listeners::navtabs
Unfortunately it keeps kicking back an error...

Code:
Error
Please enter a valid callback method.
 

Jaxel

Well-known member
#3
Autoloading is case sensitive. Your file is listeners.php, your class is Listeners.
Yep... that was the issue... there was then a second issue...

8wrXenPorta_Listeners is not a valid classname. It seems a classname can not start with a NUMBER.