mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
Make actions interceptable with yield
This commit is contained in:
parent
6e2c4d3d1e
commit
2f04411275
1 changed files with 30 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Icinga\Module\Eagle\Web;
|
||||
|
||||
use Generator;
|
||||
use Icinga\Data\ResourceFactory;
|
||||
use Icinga\Module\Eagle\Widget\ViewModeSwitcher;
|
||||
use ipl\Stdlib\Contract\PaginationInterface;
|
||||
|
|
@ -107,4 +108,33 @@ class Controller extends CompatController
|
|||
|
||||
return $viewModeSwitcher;
|
||||
}
|
||||
|
||||
public function dispatch($action)
|
||||
{
|
||||
// Notify helpers of action preDispatch state
|
||||
$this->_helper->notifyPreDispatch();
|
||||
|
||||
$this->preDispatch();
|
||||
|
||||
if ($this->getRequest()->isDispatched()) {
|
||||
// If pre-dispatch hooks introduced a redirect then stop dispatch
|
||||
// @see ZF-7496
|
||||
if (! $this->getResponse()->isRedirect()) {
|
||||
$interceptable = $this->$action();
|
||||
if ($interceptable instanceof Generator) {
|
||||
foreach ($interceptable as $stopSignal) {
|
||||
if ($stopSignal === true) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->postDispatch();
|
||||
}
|
||||
|
||||
// whats actually important here is that this action controller is
|
||||
// shutting down, regardless of dispatching; notify the helpers of this
|
||||
// state
|
||||
$this->_helper->notifyPostDispatch();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue