当前位置: 首页>>代码示例>>PHP>>正文


PHP View\HelperPluginManager类代码示例

本文整理汇总了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', '/');
 }
开发者ID:netsensia,项目名称:zf2-foundation,代码行数:31,代码来源:BootstrapFormTest.php

示例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);
 }
开发者ID:fadoe,项目名称:symfony-asset-module,代码行数:31,代码来源:SymfonyAssetViewHelperFactory.php

示例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']);
 }
开发者ID:shitikovkirill,项目名称:LearnZF2,代码行数:27,代码来源:ModuleTest.php

示例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);
 }
开发者ID:patrova,项目名称:omeka-s,代码行数:13,代码来源:AbstractRepresentation.php

示例5: testCreateService

 public function testCreateService()
 {
     $helperPluginManager = new HelperPluginManager();
     $helperPluginManager->setServiceLocator(Bootstrap::getServiceManager());
     $result = $this->testedObj->createService($helperPluginManager);
     $this->assertInstanceOf(FlashMessages::class, $result);
 }
开发者ID:omusico,项目名称:zf2-demo,代码行数:7,代码来源:FlashMessagesSLFactoryTest.php

示例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);
    }
开发者ID:jbarentsen,项目名称:drb,代码行数:25,代码来源:ChildEntitiesIntegrationTest.php

示例7: setHelperPluginManager

 public function setHelperPluginManager(HelperPluginManager $hpm)
 {
     $hpm->setView($this);
     if ($this->getEnvironment()) {
         $this->getEnvironment()->setHelperPluginManager($hpm);
     }
     return $this;
 }
开发者ID:heartsentwined,项目名称:zf2-assetwig,代码行数:8,代码来源:TwigRenderer.php

示例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);
 }
开发者ID:ferch01991,项目名称:BlogLaravel,代码行数:13,代码来源:SlugifyViewHelperFactoryTest.php

示例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;
 }
开发者ID:jmleroux,项目名称:jmlzf-helpers,代码行数:9,代码来源:QueryParamsTest.php

示例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}());
 }
开发者ID:tworzenieweb,项目名称:zf-bc-view-helpers,代码行数:9,代码来源:JobleadsHelperTest.php

示例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);
 }
开发者ID:adamh114,项目名称:zfc-rbac,代码行数:10,代码来源:IsGrantedViewHelperFactoryTest.php

示例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;
 }
开发者ID:renereed1,项目名称:proophessor-do,代码行数:15,代码来源:ViewHelperPluginManagerFactory.php

示例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');
 }
开发者ID:Belcebur,项目名称:BelceburBasic,代码行数:10,代码来源:BTools.php

示例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);
 }
开发者ID:joacub,项目名称:zfj-rbac,代码行数:10,代码来源:HasRoleViewHelperFactoryTest.php


注:本文中的Zend\View\HelperPluginManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。