Skip to content

Instantly share code, notes, and snippets.

@cgi-caesar
Created October 13, 2021 15:00
Show Gist options
  • Save cgi-caesar/9ea3efe642c05e9661ce3f31d62fba5e to your computer and use it in GitHub Desktop.
Save cgi-caesar/9ea3efe642c05e9661ce3f31d62fba5e to your computer and use it in GitHub Desktop.
Dashboard Plugin (replace standard controller with custom one)
<?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