本文整理汇总了PHP中Zend\Mvc\Controller\PluginManager::getController方法的典型用法代码示例。如果您正苦于以下问题:PHP PluginManager::getController方法的具体用法?PHP PluginManager::getController怎么用?PHP PluginManager::getController使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Mvc\Controller\PluginManager
的用法示例。
在下文中一共展示了PluginManager::getController方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __invoke
/**
* {@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;
}
示例2: __invoke
/**
* {@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;
}
示例3: __invoke
/**
* {@inheritdoc}
*/
public function __invoke(PluginManager $pluginManager)
{
/* @var Zend\ServiceManager\ServiceManager */
$serviceLocator = $pluginManager->getController()->getServiceLocator();
$plugin = new GetTableModel($serviceLocator);
return $plugin;
}
示例4: __invoke
/**
* {@inheritdoc}
*/
public function __invoke(PluginManager $pluginManager)
{
$controller = $pluginManager->getController();
$layout = $controller->layout();
$response = $controller->getResponse();
$plugin = new ErrorCodes($layout, $response);
return $plugin;
}
示例5: __invoke
/**
* {@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;
}
示例6: testInjectingPluginManagerSetsControllerWhenPossible
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());
}