<?php defined('MW_PATH') || exit('No direct script access allowed');
class CustomMenuItemsExt extends ExtensionInit
{
// name of the extension as shown in the backend panel
public $name = 'Custom menu items';
// description of the extension as shown in backend panel
public $description = 'Add new links in the menus';
// current version of this extension
public $version = '1.0';
// the author name
public $author = 'Your name';
// author website
public $website = 'http://www.website.com/';
// contact email address
public $email = 'your.email@domain.com';
// in which apps this extension is allowed to run
public $allowedApps = array('customer', 'backend');
// can this extension be deleted? this only applies to core extensions.
protected $_canBeDeleted = true;
// can this extension be disabled? this only applies to core extensions.
protected $_canBeDisabled = true;
// run the extension, this is mandatory
public function run()
{
if ($this->isAppName('backend')) {
Yii::app()->hooks->addFilter('backend_left_navigation_menu_items', function($items){
$items['jasper_reports'] = array(
'name' => Yii::t('app', 'Jasper reports'),
'icon' => 'glyphicon-book',
'active' => 'jasper_reports',
'route' => array('jasper_reports/index'),
);
return $items;
});
}
}
}