-
Notifications
You must be signed in to change notification settings - Fork 49
Cookbook
Serghei Iakovlev edited this page Apr 15, 2017
·
7 revisions
$router->addGet('/_debugbar/open',array(
'namespace'=>'Snowair\Debugbar\Controllers',
'controller'=>'\OpenHandler',
'action'=>'handle',
))->setName('debugbar.openhandler');
$router->addGet('/_debugbar/assets/stylesheets',array(
'namespace'=>'Snowair\Debugbar\Controllers',
'controller'=>'Asset',
'action'=>'css',
))->setName('debugbar.assets.css');
$router->addGet('/_debugbar/assets/javascript',array(
'namespace'=>'Snowair\Debugbar\Controllers',
'controller'=>'Asset',
'action'=>'js',
))->setName('debugbar.assets.js');
eg. If you use ACL, these codes may be helpfull:
$ns = $dispatcher->getNamespaceName();
if ($ns=='Snowair\Debugbar\Controllers') {
return true;
}
// Do ACL check logic
$di->set('volt', function($view, $di) {
// the first parameter is $view, the second is $di, don't reverse the order!
// code
}, true);
or
$di->set('volt', function() use($view, $di) {
// I suggest you register it in this way!
// code
}, true);
or
$di->set('volt', function() use( $di) {
$view = $di['view'];
// I suggest you register it in this way!
// code
}, true);