Created
October 13, 2021 15:00
-
-
Save cgi-caesar/9ea3efe642c05e9661ce3f31d62fba5e to your computer and use it in GitHub Desktop.
Dashboard Plugin (replace standard controller with custom one)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Am_Plugin_Dashboard extends Am_Plugin | |
{ | |
const PLUGIN_STATUS = self::STATUS_PRODUCTION; | |
const PLUGIN_COMM = self::COMM_COMMERCIAL; | |
const PLUGIN_REVISION = '@@VERSION@@'; | |
protected $_configPrefix = 'misc.'; | |
function onInitFinished(Am_Event $e) | |
{ | |
$e->getDi()->router->addRoute( | |
'custom-dashboard', | |
new Am_Mvc_Router_Route('member', [ | |
'module' => 'default', | |
'controller' => 'dashboard', | |
'action' => 'index', | |
] | |
)); | |
} | |
} | |
class DashboardController extends Am_Mvc_Controller | |
{ | |
function preDispatch() | |
{ | |
$this->getDi()->auth->requireLogin($this->getDi()->url('/member', false)); | |
} | |
function indexAction() | |
{ | |
$this->view->title = 'Dashboard'; | |
$this->view->content = '<p>Dashboard Content</p>'; | |
$this->view->display('member/layout.phtml'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment