You can define menus in AdminCP in file Install.php
protected function setOthers()
{
$this->admincp_menu = [
'Manage To Do' => 'todo', // 'todo' is app's alias
];
$this->admincp_route = 'admincp.todo'; // 'todo' is app's alias
}
|
After that, on start.php, we add below lines.
// 'todo' is app's alias
$module->addComponentNames('controller', [
'todo.admincp.index' => Controller\AdminManageTodoController::class
]);
group('todo/admincp', function () {
route('/', 'todo.admincp.index');
});
|
Finally, we add controller file and view file.
Path of controller file:
Path of view file:
Sample structure of a controller file
<?php
namespace Apps\TodoList\Controller;
use Phpfox_Plugin;
defined('PHPFOX') or exit('NO DICE!');
class AdminManageTodoController extends \Phpfox_Component
{
public function process()
{
//Put your code here
}
public function clean()
{
(($sPlugin = Phpfox_Plugin::get('todo.component_controller_admincp_manage_clean')) ? eval($sPlugin) : false);
}
}
|