如何从控制器操作中取消注册或禁用控制器插件。
class IndexController
{
public function indexAction()
{
// disable plugin here
// do some other stuff
}
}
答案 0 :(得分:2)
首先获取前端控制器的实例,然后获取给定名称(类名称)的插件实例,最后调用unregisterPlugin()
方法。
public function disableSomePluign()
{
$frontController = $this->getFrontController();
$plugin = $frontController->getPlugin('Some_Plugin');
$frontController->unregisterPlugin($plugin);
}