First create the context like say /bonfire/application/controllers/admin/custom.php
<?php
/**** Created by Subhajit ******/
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Custom extends Admin_Controller
{
public function __construct()
{
parent::__construct();
Template::set('toolbar_title', 'Custom');
$this->auth->restrict('Site.Custom.View');
}
public function index()
{
Template::set_view('admin/custom/index');
Template::render();
}
}
Here we are creating a context named “custom”.
Now say you want to show the “users” under custom context. So copy the file /bonfire/application/controllers/admin/custom.php to /bonfire/modules/users/controllers/custom.php
i.e. inside the controller of the ‘users’ module. Refresh the admin page and in the custom context you will see the users menu.
Here is a way to create submenus. Suppose you want to create submenu under ‘developer’ menu and ‘developer’ module. So create a folder ‘config’ in the ‘developer’ module. Inside the config folder create a file named config.php and add this code.
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
$config['module_config'] = array(
'menus' => array(
'developer' => 'database/developer/menu'
),
'author' => 'Bonfire Team',
'description' => 'Provides tools for working with your database(s).',
'menu_topic' => array(
'developer' =>'Database Tools'
)
);
The ‘menus’ in the module config array specifies from which view file to take the submenus. In this case it is from the menu view in developer folder.
So create a file menu.php in /database/views/developer/menu.php and add the following code:
<ul>
<li><a href="<?php echo site_url(SITE_AREA .'/developer/database') ?>">Maintenance</a></li>
<li><a href="<?php echo site_url(SITE_AREA .'/developer/database/backups') ?>">Backups</a></li>
</ul>
Here submenus are being specified with the <ul> <li> tags. Thus the menu have two submenus – maintenance and backups.