本文整理匯總了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());
}