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


PHP PhpRenderer::plugin方法代码示例

本文整理汇总了PHP中Zend\View\Renderer\PhpRenderer::plugin方法的典型用法代码示例。如果您正苦于以下问题:PHP PhpRenderer::plugin方法的具体用法?PHP PhpRenderer::plugin怎么用?PHP PhpRenderer::plugin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\View\Renderer\PhpRenderer的用法示例。


在下文中一共展示了PhpRenderer::plugin方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testRaisesExceptionIfViewModelHelperHasNoRoot

 public function testRaisesExceptionIfViewModelHelperHasNoRoot()
 {
     $renderer = new PhpRenderer();
     $viewModelHelper = $renderer->plugin('view_model');
     $helper = $renderer->plugin('layout');
     $this->setExpectedException('Zend\\View\\Exception\\RuntimeException', 'view model');
     $helper->setTemplate('foo/bar');
 }
开发者ID:razvansividra,项目名称:pnlzf2-1,代码行数:8,代码来源:LayoutTest.php

示例2: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 protected function setUp()
 {
     $serviceManager = Registry::get('Application')->getServiceManager();
     $this->renderer = new PhpRenderer();
     $renderer = $serviceManager->get('Zend\\View\\Renderer\\PhpRenderer');
     $this->renderer->setHelperPluginManager($renderer->getHelperPluginManager());
     $serviceManager->setAllowOverride(true);
     $serviceManager->setService('currentDocument', DocumentModel::fromArray(array('id' => 1)));
     $serviceManager->setAllowOverride(false);
     $this->object = $this->renderer->plugin('modulePlugin');
     $this->module = ModuleModel::fromArray(array('name' => 'Blog'));
     $this->module->save();
 }
开发者ID:gotcms,项目名称:gotcms,代码行数:19,代码来源:ModulePluginTest.php

示例3: setUp

 public function setUp()
 {
     $this->resolver = new TemplateMapResolver(array('layout' => __DIR__ . '/../_templates/nested-view-model-layout.phtml', 'child1' => __DIR__ . '/../_templates/nested-view-model-content.phtml', 'child2' => __DIR__ . '/../_templates/nested-view-model-child2.phtml', 'complex' => __DIR__ . '/../_templates/nested-view-model-complexlayout.phtml'));
     $this->renderer = $renderer = new PhpRenderer();
     $renderer->setCanRenderTrees(true);
     $renderer->setResolver($this->resolver);
     $this->viewModelHelper = $renderer->plugin('view_model');
     $this->helper = $renderer->plugin('render_child_model');
     $this->parent = new ViewModel();
     $this->parent->setTemplate('layout');
     $this->viewModelHelper->setRoot($this->parent);
     $this->viewModelHelper->setCurrent($this->parent);
 }
开发者ID:haoyanfei,项目名称:zf2,代码行数:13,代码来源:RenderChildModelTest.php

示例4: setUp

 /**
  * @see PHPUnit_Framework_TestCase::setUp()
  */
 protected function setUp()
 {
     $view = new View();
     $view->plugin('basepath')->setBasePath('');
     $translator = $this->getMockBuilder(Translator::class)->getMock();
     $translator->method('translate')->willReturnArgument(0);
     $this->fileUploadHelper = new FileUploadHelper();
     $this->fileUploadHelper->setView($view);
     $this->fileUploadHelper->setTranslator($translator);
 }
开发者ID:cross-solution,项目名称:yawik,代码行数:13,代码来源:FormFileUploadTest.php

示例5: testInvoke

 public function testInvoke()
 {
     $renderer = new PhpRenderer();
     /* @var $url Url */
     $url = $renderer->plugin('url');
     $url->setRouter(Bootstrap::getServiceManager()->get('HttpRouter'));
     $esiUrl = new EsiUrl();
     $esiUrl->setView($renderer);
     $this->assertEquals('/esi/my-block', call_user_func($esiUrl, 'my-block'));
     $this->assertEquals('/esi/my-block?handles%5B0%5D=handle1&handles%5B1%5D=handle2', call_user_func($esiUrl, 'my-block', ['handle1', 'handle2']));
 }
开发者ID:hummer2k,项目名称:convarnish,代码行数:11,代码来源:EsiUrlTest.php

示例6: createService

 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $renderer = new PhpRenderer();
     $helperManager = $serviceLocator->get('ViewHelperManager');
     $resolver = $serviceLocator->get('ViewResolver');
     $renderer->setHelperPluginManager($helperManager);
     $renderer->setResolver($resolver);
     $model = $serviceLocator->get('Application')->getMvcEvent()->getViewModel();
     $modelHelper = $renderer->plugin('view_model');
     $modelHelper->setRoot($model);
     return $renderer;
 }
开发者ID:finbarrmccarthy,项目名称:mailservice,代码行数:12,代码来源:MailPhpRendererFactory.php

示例7: getPluginViewData

 /**
  * Get a plugin instance rendered view.
  *
  * @param string  $pluginName           Plugin name
  * @param integer $pluginInstanceId     Plugin Instance Id
  * @param array   $pluginInstanceConfig Plugin Instance Config
  *
  * @return array
  * @throws \Rcm\Exception\InvalidPluginException
  * @throws \Rcm\Exception\PluginReturnedResponseException
  */
 public function getPluginViewData($pluginName, $pluginInstanceId, $pluginInstanceConfig)
 {
     /** @var \Rcm\Plugin\PluginInterface $controller */
     $controller = $this->getPluginController($pluginName);
     if (!is_a($controller, '\\Rcm\\Plugin\\PluginInterface')) {
         throw new InvalidPluginException('Plugin ' . $controller . ' must implement the PluginInterface');
     }
     $controller->setRequest($this->request);
     $response = new Response();
     $controller->setResponse($response);
     /** @var \Zend\Mvc\MvcEvent $event */
     $event = $controller->getEvent();
     $event->setRequest($this->request);
     $event->setResponse($response);
     $controller->setEvent($event);
     $viewModel = $controller->renderInstance($pluginInstanceId, $pluginInstanceConfig);
     if ($viewModel instanceof ResponseInterface) {
         $event = new ViewEvent();
         $event->setResponse($viewModel);
         $this->eventManager->trigger(ViewEvent::EVENT_RESPONSE, $event);
         return null;
     }
     /** @var \Zend\View\Helper\Headlink $headlink */
     $headlink = $this->renderer->plugin('headlink');
     /** @var \Zend\View\Helper\HeadScript $headScript */
     $headScript = $this->renderer->plugin('headscript');
     $oldContainer = $headlink->getContainer();
     $linkContainer = new Container();
     $headlink->setContainer($linkContainer);
     $oldScriptContainer = $headScript->getContainer();
     $headScriptContainer = new Container();
     $headScript->setContainer($headScriptContainer);
     $html = $this->renderer->render($viewModel);
     $css = $headlink->getContainer()->getArrayCopy();
     $script = $headScript->getContainer()->getArrayCopy();
     $return = ['html' => $html, 'css' => $this->getContainerSrc($css), 'js' => $this->getContainerSrc($script), 'editJs' => '', 'editCss' => '', 'displayName' => '', 'tooltip' => '', 'icon' => '', 'siteWide' => false, 'md5' => '', 'fromCache' => false, 'canCache' => false, 'pluginName' => $pluginName, 'pluginInstanceId' => $pluginInstanceId];
     if (isset($this->config['rcmPlugin'][$pluginName]['display'])) {
         $return['displayName'] = $this->config['rcmPlugin'][$pluginName]['display'];
     }
     if (isset($this->config['rcmPlugin'][$pluginName]['tooltip'])) {
         $return['tooltip'] = $this->config['rcmPlugin'][$pluginName]['tooltip'];
     }
     if (isset($this->config['rcmPlugin'][$pluginName]['icon'])) {
         $return['icon'] = $this->config['rcmPlugin'][$pluginName]['icon'];
     }
     if (isset($this->config['rcmPlugin'][$pluginName]['canCache'])) {
         $return['canCache'] = $this->config['rcmPlugin'][$pluginName]['canCache'];
     }
     $headlink->setContainer($oldContainer);
     $headScript->setContainer($oldScriptContainer);
     return $return;
 }
开发者ID:reliv,项目名称:rcm,代码行数:63,代码来源:PluginManager.php

示例8: getMatchesFromInlineScript

 /**
  * Get rules and messages as matches from the inlineScript string
  *
  * @return array
  */
 protected function getMatchesFromInlineScript()
 {
     /** @var $inlineScript \Zend\View\Helper\InlineScript */
     $inlineScript = $this->view->plugin('inlineScript');
     $inlineString = preg_replace('/(\\r\\n|\\r|\\n|\\t)+/', '', $inlineScript->toString());
     if (preg_match('/\\$\\(\'form\\[name=\\"(?P<form>[a-z]*)"\\]\'\\)\\.validate\\((?P<options>.*)\\);}\\);/', $inlineString, $matches)) {
         $options = json_decode($matches['options'], true);
         $matches['rules'] = $options['rules'];
         $matches['messages'] = $options['messages'];
         return $matches;
     }
     return array();
 }
开发者ID:rettal,项目名称:zf2-form,代码行数:18,代码来源:RendererTest.php

示例9: renderFieldset

 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
 {
     $output = '';
     if ($fieldset->has('Packages')) {
         $packages = $fieldset->get('Packages');
         if ($packages->count()) {
             $formRow = $view->plugin('FormRow');
             $translatorEnabled = $formRow->isTranslatorEnabled();
             $formRow->setTranslatorEnabled(false);
             $output = "<div class='table'>\n";
             foreach ($packages as $package) {
                 $output .= $view->formRow($package, 'append') . "\n\n";
             }
             $output .= "<span class='cell'></span>\n";
             $output .= $view->formSubmit($fieldset->get('Submit')) . "\n";
             $output .= "</div>\n";
             $formRow->setTranslatorEnabled($translatorEnabled);
         }
     }
     return $output;
 }
开发者ID:hschletz,项目名称:braintacle,代码行数:22,代码来源:Assign.php

示例10: testImageTagRenderedProperlyBasedUponDoctype

 /**
  * @group ZF-11483
  */
 public function testImageTagRenderedProperlyBasedUponDoctype()
 {
     $this->testCaptchaIsRendered();
     $view = new View();
     $view->plugin('doctype')->setDoctype('XHTML1_STRICT');
     $this->assertRegExp('#/>$#', $this->captcha->render($view));
     $view->plugin('doctype')->setDoctype('HTML4_STRICT');
     $this->assertRegExp('#[^/]>$#', $this->captcha->render($view));
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:12,代码来源:ImageTest.php

示例11: testCharset

 /**
  * @issue ZF-7722
  */
 public function testCharset()
 {
     $view = new View();
     $view->plugin('doctype')->__invoke('HTML5');
     $view->plugin('headMeta')->setCharset('utf-8');
     $this->assertEquals('<meta charset="utf-8">', $view->plugin('headMeta')->toString());
     $view->plugin('doctype')->__invoke('XHTML5');
     $this->assertEquals('<meta charset="utf-8"/>', $view->plugin('headMeta')->toString());
 }
开发者ID:navtis,项目名称:xerxes-pazpar2,代码行数:12,代码来源:HeadMetaTest.php

示例12: testGetDocument

 /**
  * Test
  *
  * @return void
  */
 public function testGetDocument()
 {
     $parent = new ViewModel();
     $parent->setTemplate('layout');
     $view = new View();
     $renderer = Registry::get('Application')->getServiceManager()->get('Zend\\View\\Renderer\\PhpRenderer');
     $view->setHelperPluginManager($renderer->getHelperPluginManager());
     $view->plugin('view_model')->setRoot($parent);
     $view->resolver()->addPath(__DIR__ . '/_files/views');
     $this->object->setView($view);
     $this->assertInstanceOf('Gc\\Document\\Model', $this->object->getDocument());
 }
开发者ID:gotcms,项目名称:gotcms,代码行数:17,代码来源:ScriptTest.php

示例13: renderFieldset

 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
 {
     if ($fieldset->getName() == 'Fields') {
         // Labels (except "Category") are user defined and must not be translated.
         $fieldset->get('TAG')->setLabel($view->translate('Category'));
         $formRow = $view->plugin('FormRow');
         $translatorEnabled = $formRow->isTranslatorEnabled();
         $formRow->setTranslatorEnabled(false);
         $output = parent::renderFieldset($view, $fieldset);
         $formRow->setTranslatorEnabled($translatorEnabled);
     } else {
         $output = $this->renderFieldset($view, $this->get('Fields'));
         $output .= "<div class='table'>\n";
         $output .= "<span class='cell'></span>\n";
         $output .= $view->formSubmit($fieldset->get('Submit')) . "\n";
         $output .= "</div>\n";
     }
     return $output;
 }
开发者ID:hschletz,项目名称:braintacle,代码行数:20,代码来源:CustomFields.php

示例14: getFunctions

 /**
  * @inheritdoc
  */
 public function getFunctions()
 {
     foreach ($this->viewHelpers['aliases'] as $alias => $factory) {
         (yield new \Twig_SimpleFunction($alias, [$this->renderer->plugin($factory), '__invoke'], ['is_safe' => ['html']]));
     }
 }
开发者ID:oqq,项目名称:ci-zend-form-twig-extension,代码行数:9,代码来源:ZendFormTwigExtension.php


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