本文整理汇总了PHP中Zend\View\HelperPluginManager类的典型用法代码示例。如果您正苦于以下问题:PHP HelperPluginManager类的具体用法?PHP HelperPluginManager怎么用?PHP HelperPluginManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HelperPluginManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCanRenderFieldsets
/**
* @outputBuffering disabled
*/
public function testCanRenderFieldsets()
{
$this->expectOutputRegex('/<form(.*)<fieldset(.*)<\\/fieldset>(.*)<fieldset(.*)<\\/fieldset>(.*)<\\/form>/');
$form = new NetsensiaForm();
$form->addHidden('test1', 'testvalue');
$hidden = new Element\Hidden('asdasd');
$hidden->setValue('123');
$form->add($hidden);
$element1 = new Text('testelement1');
$element1->setLabel('Test Element');
$element1->setAttribute('icon', 'pencil');
$element2 = new Text('testelement2');
$element2->setLabel('Test Element 2');
$element2->setAttribute('icon', 'pencil');
$fieldset1 = new Fieldset('testfieldset1');
$fieldset1->add($element1);
$fieldset2 = new Fieldset('testfieldset2');
$fieldset2->add($element2);
$form->add($fieldset1);
$form->add($fieldset2);
$helpers = new HelperPluginManager();
$helpers->setService('formElement', new FormElement());
$view = new PhpRenderer();
$view->setHelperPluginManager($helpers);
$viewHelper = new BootstrapForm();
$viewHelper->setView($view);
$viewHelper($form, 'testform', '/');
}
示例2: __invoke
/**
* @param HelperPluginManager $pluginManager
*
* @return SymfonyAssetViewHelper
* @throws \Exception
*/
public function __invoke(HelperPluginManager $pluginManager)
{
$serviceLocator = $pluginManager->getServiceLocator();
$config = $serviceLocator->get('Config');
if (false === isset($config['fadoe_symfony_asset_module'])) {
throw new \Exception('Config not found');
}
$config = $config['fadoe_symfony_asset_module'];
$packagesService = $serviceLocator->get('FaDoe\\SymfonyAssetModule\\PackagesService');
$version = $config['version'];
$versionFormat = $config['version_format'];
$basePath = $config['base_path'];
$baseUrls = $config['base_urls'];
$defaultPackage = $packagesService->createService($version, $versionFormat, $basePath, $baseUrls);
$namedPackages = [];
foreach ($config['packages'] as $key => $value) {
$version = $value['version'];
$versionFormat = $value['version_format'];
$basePath = $value['base_path'];
$baseUrls = $value['base_urls'];
$namedPackages[$key] = $packagesService->createService($version, $versionFormat, $basePath, $baseUrls);
}
$packages = new Packages($defaultPackage, $namedPackages);
return new SymfonyAssetViewHelper($packages);
}
示例3: testOnDispatch
public function testOnDispatch()
{
// Create MvcEvent
$e = new MvcEvent();
$e->setViewModel(new ViewModel());
$rm = new RouteMatch([]);
$rm->setParam('controller', 'Application\\Controller\\Download');
$e->setRouteMatch($rm);
$e->setTarget(new DownloadController([]));
// Create EntityManager and EntityRepository
$moduleDetail = new ModuleList();
$moduleDetail->setModuleDesc('Pretty description');
$repo = $this->prophesize('Doctrine\\ORM\\EntityRepository');
$repo->findOneBy(['moduleName' => 'Application'])->willReturn($moduleDetail);
$em = $this->prophesize('Doctrine\\ORM\\EntityManager');
$em->getRepository('Application\\Entity\\ModuleList')->willReturn($repo);
$this->sm->setService('Doctrine\\ORM\\EntityManager', $em->reveal());
// Create ViewHelperManager
$headTitle = new HeadTitle();
$vhm = new HelperPluginManager();
$vhm->setService('headTitle', $headTitle);
$this->sm->setService('ViewHelperManager', $vhm);
$this->module->onDispatch($e);
$fbMeta = $e->getViewModel()->getVariable('fbMeta');
$this->assertEquals(sprintf('%s-Real Live Learn ZF2', $moduleDetail->getModuleDesc()), $fbMeta['title']);
$this->assertEquals(sprintf('%s-', $moduleDetail->getModuleDesc()), $fbMeta['description']);
}
示例4: getViewHelper
/**
* Get a view helper from the manager.
*
* @param string $name
* @return TranslatorInterface
*/
protected function getViewHelper($name)
{
if (!$this->viewHelperManager instanceof HelperPluginManager) {
$this->viewHelperManager = $this->getServiceLocator()->get('ViewHelperManager');
}
return $this->viewHelperManager->get($name);
}
示例5: testCreateService
public function testCreateService()
{
$helperPluginManager = new HelperPluginManager();
$helperPluginManager->setServiceLocator(Bootstrap::getServiceManager());
$result = $this->testedObj->createService($helperPluginManager);
$this->assertInstanceOf(FlashMessages::class, $result);
}
示例6: setupHelpers
public function setupHelpers()
{
if (!$this->router) {
$this->setupRouter();
}
$urlHelper = new UrlHelper();
$urlHelper->setRouter($this->router);
$serverUrlHelper = new ServerUrlHelper();
$serverUrlHelper->setScheme('http');
$serverUrlHelper->setHost('localhost.localdomain');
$linksHelper = new HalHelper();
$linksHelper->setUrlHelper($urlHelper);
$linksHelper->setServerUrlHelper($serverUrlHelper);
$this->helpers = $helpers = new HelperPluginManager();
$helpers->setService('url', $urlHelper);
$helpers->setService('serverUrl', $serverUrlHelper);
$helpers->setService('hal', $linksHelper);
$this->plugins = $plugins = new ControllerPluginManager();
$plugins->setService('hal', $linksHelper);
}
示例7: setHelperPluginManager
public function setHelperPluginManager(HelperPluginManager $hpm)
{
$hpm->setView($this);
if ($this->getEnvironment()) {
$this->getEnvironment()->setHelperPluginManager($hpm);
}
return $this;
}
示例8: __invoke
public function __invoke(ContainerInterface $container)
{
$config = $container->has('config') ? $container->get('config') : [];
$config = isset($config['view_helpers']) ? $config['view_helpers'] : [];
$manager = new HelperPluginManager(new Config($config));
$manager->setServiceLocator($container);
return $manager;
}
开发者ID:fabiocarneiro,项目名称:zend-expressive-zendviewrenderer,代码行数:8,代码来源:HelperPluginManagerFactory.php
示例9: createService
/**
* @test
* @covers Cocur\Slugify\Bridge\ZF2\SlugifyViewHelperFactory::__invoke()
*/
public function createService()
{
$sm = new ServiceManager();
$sm->setService('Cocur\\Slugify\\Slugify', new Slugify());
$vhm = new HelperPluginManager();
$vhm->setServiceLocator($sm);
$viewHelper = call_user_func($this->factory, $vhm);
$this->assertInstanceOf('Cocur\\Slugify\\Bridge\\ZF2\\SlugifyViewHelper', $viewHelper);
}
示例10: setUp
protected function setUp()
{
$this->request = new Request();
$serviceManager = new ServiceManager();
$serviceManager->setService('request', $this->request);
$pluginManager = new HelperPluginManager();
$pluginManager->setServiceLocator($serviceManager);
$this->pluginManager = $pluginManager;
}
示例11: testCompatibilityWithZF2View
public function testCompatibilityWithZF2View()
{
$renderer = new PhpRenderer();
$helpers = new HelperPluginManager();
$name = $this->jobleadsHelper->getName();
$helpers->setInvokableClass($name, get_class($this->jobleadsHelper));
$renderer->setHelperPluginManager($helpers);
$this->assertEquals(self::EXPECTED_RETURN, $renderer->{$name}());
}
示例12: testFactory
public function testFactory()
{
$serviceManager = new ServiceManager();
$pluginManager = new HelperPluginManager();
$pluginManager->setServiceLocator($serviceManager);
$serviceManager->setService('ZfcRbac\\Service\\AuthorizationService', $this->getMock('ZfcRbac\\Service\\AuthorizationServiceInterface'));
$factory = new IsGrantedViewHelperFactory();
$isGranted = $factory->createService($pluginManager);
$this->assertInstanceOf('ZfcRbac\\View\\Helper\\IsGranted', $isGranted);
}
示例13: __invoke
/**
* @param ContainerInterface $container
* @throws \RuntimeException
* @return HelperPluginManager
*/
public function __invoke(ContainerInterface $container)
{
$helperPluginManager = new HelperPluginManager();
$helperPluginManager->setRetrieveFromPeeringManagerFirst();
if (!$container instanceof ServiceManager) {
throw new \RuntimeException(__CLASS__ . ' can only be used when Zend\\ServiceManager\\ServiceManager is used as container');
}
$helperPluginManager->addPeeringServiceManager($container);
return $helperPluginManager;
}
示例14: __construct
public function __construct(HelperPluginManager $pluginManager)
{
$this->pluginManager = $pluginManager;
$this->serviceManager = $pluginManager->getServiceLocator();
$this->app = $pluginManager->getServiceLocator()->get('Application');
$this->request = $this->app->getRequest();
$this->event = $this->app->getMvcEvent();
$this->em = $this->serviceManager->get('Doctrine\\ORM\\EntityManager');
$this->translator = $this->serviceManager->get('translator');
}
示例15: testFactory
public function testFactory()
{
$serviceManager = new ServiceManager();
$pluginManager = new HelperPluginManager();
$pluginManager->setServiceLocator($serviceManager);
$serviceManager->setService('ZfjRbac\\Service\\RoleService', $this->getMock('ZfjRbac\\Service\\RoleService', [], [], '', false));
$factory = new HasRoleViewHelperFactory();
$viewHelper = $factory->createService($pluginManager);
$this->assertInstanceOf('ZfjRbac\\View\\Helper\\HasRole', $viewHelper);
}