本文整理汇总了PHP中Zend\Mvc\Controller\AbstractActionController::attachDefaultListeners方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractActionController::attachDefaultListeners方法的具体用法?PHP AbstractActionController::attachDefaultListeners怎么用?PHP AbstractActionController::attachDefaultListeners使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Mvc\Controller\AbstractActionController
的用法示例。
在下文中一共展示了AbstractActionController::attachDefaultListeners方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: attachDefaultListeners
/**
* Register the default events for this controller
*
* @return void
*/
protected function attachDefaultListeners()
{
parent::attachDefaultListeners();
$events = $this->getEventManager();
$events->attach('dispatch', array($this, 'initJsController'), -10);
$events->attach('dispatch', array($this->getJsLoader(), 'onMvcDispatch'), -90);
}
示例2: attachDefaultListeners
/**
* Se encarga de colgar las funciones predispatch y post dispatch para ser ejecutados
* antes y despues del controlador principal y poder realizar tareas comunes de
* inicializacion y post procesamiento
* @see \Zend\Mvc\Controller\AbstractController::attachDefaultListeners()
*/
protected function attachDefaultListeners()
{
parent::attachDefaultListeners();
$events = $this->getEventManager();
$events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'preDispatch'), 100);
$events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'postDispatch'), -100);
}
示例3: attachDefaultListeners
public function attachDefaultListeners()
{
parent::attachDefaultListeners();
$events = $this->getEventManager();
/* This must run before onDispatch, because we could alter the action param */
$events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'checkPostRequest'), 10);
return $this;
}
示例4: attachDefaultListeners
protected function attachDefaultListeners()
{
parent::attachDefaultListeners();
/**
* @todo Think of how we can automatically redirect to allow page if user hasn't installed
*/
$this->events->attach('dispatch', array($this, 'preDispatch'), 100);
}
示例5: attachDefaultListeners
/**
* attaches further Listeners for generating / processing the output
*
* @return $this
*/
public function attachDefaultListeners()
{
parent::attachDefaultListeners();
$serviceLocator = $this->getServiceLocator();
$defaultServices = $serviceLocator->get('DefaultListeners');
$events = $this->getEventManager();
$events->attach($defaultServices);
return $this;
}
示例6: attachDefaultListeners
/**
* Register the default events for this controller
*
* @return void
*/
protected function attachDefaultListeners()
{
parent::attachDefaultListeners();
// Attach preDispatch event if we need to check permissions.
if ($this->accessPermission) {
$events = $this->getEventManager();
$events->attach(MvcEvent::EVENT_DISPATCH, [$this, 'preDispatch'], 1000);
}
}
示例7: attachDefaultListeners
protected function attachDefaultListeners()
{
parent::attachDefaultListeners();
$events = $this->getEventManager();
$events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'preDispatch'), 10);
$serviceLocator = $this->getServiceLocator();
$defaultServices = $serviceLocator->get('DefaultListeners');
$events->attach($defaultServices);
}
示例8: attachDefaultListeners
/**
* Register the default events for this controller
*
* @internal
* Registers two hooks on "onDispatch":
* - change action to form and set mode parameter
* - inject sidebar navigation
*/
protected function attachDefaultListeners()
{
parent::attachDefaultListeners();
$events = $this->getEventManager();
/*
* "Redirect" action 'new' and 'edit' to 'form' and set the
* route parameter 'mode' to the original action.
* This must run before onDispatch, because we alter the action param
*/
$events->attach(MvcEvent::EVENT_DISPATCH, function ($event) {
$routeMatch = $event->getRouteMatch();
$action = $routeMatch->getParam('action');
if ('new' == $action || 'edit' == $action) {
$routeMatch->setParam('mode', $action);
$routeMatch->setParam('action', 'form');
}
}, 10);
/*
* Inject a sidebar view model in the Layout-Model, if
* the result in the event is not terminal.
* This must run after "InjectViewModelListener", which runs with
* a priority of -100.
*/
$events->attach(MvcEvent::EVENT_DISPATCH, function ($event) {
$model = $event->getResult();
if (!$model instanceof ViewModel || $model->terminate()) {
return;
}
$routeMatch = $event->getRouteMatch();
$action = $routeMatch->getParam('action');
if ('form' == $action) {
$action = $routeMatch->getParam('mode');
}
$layout = $event->getViewModel();
$sidebar = new ViewModel();
$sidebar->setVariable('action', $action);
$sidebar->setTemplate('auth/sidebar/groups-menu');
$layout->addChild($sidebar, 'sidebar_auth_groups-menu');
}, -110);
$serviceLocator = $this->getServiceLocator();
$defaultServices = $serviceLocator->get('DefaultListeners');
$events->attach($defaultServices);
}
示例9: attachDefaultListeners
/**
* Attache les évènements
*
* @see \Zend\Mvc\Controller\AbstractController::attachDefaultListeners()
*/
protected function attachDefaultListeners()
{
parent::attachDefaultListeners();
$events = $this->getEventManager();
$events->attach('dispatch', array($this, 'preDispatch'), 100);
}
示例10: attachDefaultListeners
/**
* @return void
*/
protected function attachDefaultListeners()
{
parent::attachDefaultListeners();
$this->events->attach('dispatch', array($this, 'preDispatch'), 100);
$this->events->attach('dispatch', array($this, 'postDispatch'), -100);
}