getController() public method

Retrieve controller instance
public getController ( ) : null | Zend\Stdlib\DispatchableInterface
return null | Zend\Stdlib\DispatchableInterface
Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  *
  * @param PluginManager $pluginManager
  *
  * @return InitMetaTags
  */
 public function __invoke(PluginManager $pluginManager)
 {
     /* @var \Zend\ServiceManager\ServiceManager */
     $viewHelper = $pluginManager->getController()->getServiceLocator()->get('ViewHelperManager');
     /*
      * @var \Zend\View\Helper\Placeholder\Container
      */
     $placeholderContainer = $viewHelper->get('placeholder')->getContainer('customHead');
     /*
      * @var \Zend\View\Helper\HeadMeta
      */
     $headMeta = $viewHelper->get('HeadMeta');
     /*
      * @var \Zend\Http\PhpEnvironment\Request
      */
     $request = $pluginManager->getController()->getRequest();
     /*
      * @var \SD\Application\Controller\Plugin\SystemSettings
      */
     $systemSettings = $pluginManager->get('systemsettings');
     /*
      * @var InitMetaTags
      */
     $plugin = new InitMetaTags($placeholderContainer, $headMeta, $request, $systemSettings);
     return $plugin;
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  *
  * @param PluginManager $pluginManager
  *
  * @return Translate
  */
 public function __invoke(PluginManager $pluginManager)
 {
     /* @var \Zend\ServiceManager\ServiceManager */
     $translator = $pluginManager->getController()->getServiceLocator()->get('translator')->getTranslator();
     $plugin = new Translate($translator);
     return $plugin;
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function __invoke(PluginManager $pluginManager)
 {
     /* @var Zend\ServiceManager\ServiceManager */
     $serviceLocator = $pluginManager->getController()->getServiceLocator();
     $plugin = new GetTableModel($serviceLocator);
     return $plugin;
 }
Ejemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function __invoke(PluginManager $pluginManager)
 {
     $controller = $pluginManager->getController();
     $layout = $controller->layout();
     $response = $controller->getResponse();
     $plugin = new ErrorCodes($layout, $response);
     return $plugin;
 }
Ejemplo n.º 5
0
 /**
  * {@inheritdoc}
  *
  * @param PluginManager $pluginManager
  *
  * @return SystemSettings
  */
 public function __invoke(PluginManager $pluginManager)
 {
     /* @var \Zend\ServiceManager\ServiceLocatorInterface */
     $serviceLocator = $pluginManager->getController()->getServiceLocator();
     $config = $serviceLocator->get('Config');
     /*
      * No need to pass a second argument, just for the theme name. Instead,merge it into the already system config array
      */
     $config['system_config']['theme']['name'] = $config['theme']['name'];
     $plugin = new SystemSettings($config['system_config']);
     return $plugin;
 }
 public function testInjectingPluginManagerSetsControllerWhenPossible()
 {
     $plugins = new PluginManager();
     $this->assertNull($plugins->getController());
     $this->controller->setPluginManager($plugins);
     $this->assertSame($this->controller, $plugins->getController());
     $this->assertSame($plugins, $this->controller->getPluginManager());
 }