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


PHP RenderingContextInterface::getViewHelperVariableContainer方法代码示例

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


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

示例1: renderStatic

 /**
  * Default implementation for use in compiled templates
  *
  * @param array $arguments
  * @param \Closure $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  * @return mixed
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     if (self::$staticReflectionService === NULL) {
         $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
         self::$staticReflectionService = $objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService');
     }
     $property = $arguments['property'];
     $validatorName = isset($arguments['validatorName']) ? $arguments['validatorName'] : NULL;
     $object = isset($arguments['object']) ? $arguments['object'] : NULL;
     if (NULL === $object) {
         $object = self::getFormObject($renderingContext->getViewHelperVariableContainer());
     }
     $className = get_class($object);
     if (FALSE !== strpos($property, '.')) {
         $pathSegments = explode('.', $property);
         foreach ($pathSegments as $property) {
             if (TRUE === ctype_digit($property)) {
                 continue;
             }
             $annotations = self::$staticReflectionService->getPropertyTagValues($className, $property, 'var');
             $possibleClassName = array_pop($annotations);
             if (FALSE !== strpos($possibleClassName, '<')) {
                 $className = array_pop(explode('<', trim($possibleClassName, '>')));
             } elseif (TRUE === class_exists($possibleClassName)) {
                 $className = $possibleClassName;
             }
         }
     }
     $annotations = self::$staticReflectionService->getPropertyTagValues($className, $property, 'validate');
     $hasEvaluated = TRUE;
     if (0 < count($annotations) && (NULL === $validatorName || TRUE === in_array($validatorName, $annotations))) {
         return static::renderStaticThenChild($arguments, $hasEvaluated);
     }
     return static::renderStaticElseChild($arguments, $hasEvaluated);
 }
开发者ID:smichaelsen,项目名称:vhs,代码行数:43,代码来源:HasValidatorViewHelper.php

示例2: renderStatic

 /**
  * @param array $arguments
  * @param \Closure $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  * @return void
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $viewHelperVariableContainer = $renderingContext->getViewHelperVariableContainer();
     $templateVariableContainer = $renderingContext->getTemplateVariableContainer();
     $extensionName = static::getExtensionNameFromRenderingContextOrArguments($renderingContext, $arguments);
     $formClassName = FluxPackageFactory::getPackageWithFallback($extensionName)->getImplementation(FluxPackage::IMPLEMENTATION_FORM);
     $form = call_user_func_array(array($formClassName, 'create'), array());
     $container = $form->last();
     // configure Form instance
     $form->setId($arguments['id']);
     $form->setName($arguments['id']);
     $form->setLabel($arguments['label']);
     $form->setDescription($arguments['description']);
     $form->setEnabled($arguments['enabled']);
     $form->setCompact($arguments['compact']);
     $form->setExtensionName($extensionName);
     $form->setLocalLanguageFileRelativePath($arguments['localLanguageFileRelativePath']);
     $form->setVariables((array) $arguments['variables']);
     $form->setOptions((array) $arguments['options']);
     if (FALSE === $form->hasOption(Form::OPTION_ICON)) {
         $form->setOption(Form::OPTION_ICON, $arguments['icon']);
     }
     if (FALSE === $form->hasOption(Form::OPTION_GROUP)) {
         $form->setOption(Form::OPTION_GROUP, $arguments['wizardTab']);
     }
     // rendering child nodes with Form's last sheet as active container
     $viewHelperVariableContainer->addOrUpdate(static::SCOPE, static::SCOPE_VARIABLE_FORM, $form);
     $viewHelperVariableContainer->addOrUpdate(static::SCOPE, static::SCOPE_VARIABLE_EXTENSIONNAME, $extensionName);
     $templateVariableContainer->add(static::SCOPE_VARIABLE_FORM, $form);
     static::setContainerInRenderingContext($renderingContext, $container);
     $renderChildrenClosure();
     $viewHelperVariableContainer->remove(static::SCOPE, static::SCOPE_VARIABLE_EXTENSIONNAME);
     $viewHelperVariableContainer->remove(static::SCOPE, static::SCOPE_VARIABLE_CONTAINER);
     $templateVariableContainer->remove(static::SCOPE_VARIABLE_CONTAINER);
 }
开发者ID:fluidtypo3,项目名称:flux,代码行数:41,代码来源:FormViewHelper.php

示例3: renderStatic

 /**
  * @param array $arguments
  * @param callable $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  *
  * @return mixed|string
  * @throws Exception
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $value = $arguments['value'];
     $default = $arguments['default'];
     $viewHelperVariableContainer = $renderingContext->getViewHelperVariableContainer();
     if (!$viewHelperVariableContainer->exists(SwitchViewHelper::class, 'stateStack')) {
         throw new Exception('The case View helper can only be used within a switch View helper', 1368112037);
     }
     if (is_null($value) && $default === false) {
         throw new Exception('The case View helper must have either value or default argument', 1382867521);
     }
     $stateStack = $viewHelperVariableContainer->get(SwitchViewHelper::class, 'stateStack');
     $currentState = array_pop($stateStack);
     if ($currentState['break'] === true) {
         return '';
     }
     // non-type-safe comparison by intention
     if ($default === true || $currentState['expression'] == $value) {
         $currentState['break'] = true;
         $stateStack[] = $currentState;
         $viewHelperVariableContainer->addOrUpdate(SwitchViewHelper::class, 'stateStack', $stateStack);
         return $renderChildrenClosure();
     }
     return '';
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:33,代码来源:CaseViewHelper.php

示例4: viewHelperVariableContainerCanBeReadCorrectly

 /**
  * @test
  */
 public function viewHelperVariableContainerCanBeReadCorrectly()
 {
     $viewHelperVariableContainer = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\ViewHelperVariableContainer');
     $this->renderingContext->_set('viewHelperVariableContainer', $viewHelperVariableContainer);
     $this->assertSame($viewHelperVariableContainer, $this->renderingContext->getViewHelperVariableContainer());
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:9,代码来源:RenderingContextTest.php

示例5: determineBooleanOf

 /**
  * @param RenderingContextInterface $context
  * @param mixed $var
  * @return boolean
  */
 protected function determineBooleanOf($context, $var)
 {
     if (TRUE === $context->getViewHelperVariableContainer()->exists('FluidTYPO3\\Vhs\\ViewHelpers\\SwitchViewHelper', $var)) {
         return $context->getViewHelperVariableContainer()->get('FluidTYPO3\\Vhs\\ViewHelpers\\SwitchViewHelper', $var);
     }
     return FALSE;
 }
开发者ID:smichaelsen,项目名称:vhs,代码行数:12,代码来源:SwitchViewHelper.php

示例6: setRenderingContext

 /**
  * @param \TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext
  * @return void
  */
 public function setRenderingContext(\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 {
     $this->renderingContext = $renderingContext;
     $this->templateVariableContainer = $renderingContext->getTemplateVariableContainer();
     if ($renderingContext->getControllerContext() !== null) {
         $this->controllerContext = $renderingContext->getControllerContext();
     }
     $this->viewHelperVariableContainer = $renderingContext->getViewHelperVariableContainer();
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:13,代码来源:AbstractViewHelper.php

示例7: setRenderingContext

 /**
  * Injects a fresh rendering context
  *
  * @param \TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext
  * @return void
  */
 public function setRenderingContext(\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 {
     $this->baseRenderingContext = $renderingContext;
     $this->baseRenderingContext->getViewHelperVariableContainer()->setView($this);
     $this->controllerContext = $renderingContext->getControllerContext();
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:12,代码来源:AbstractTemplateView.php

示例8: setContainerInRenderingContext

 /**
  * @param RenderingContextInterface $renderingContext
  * @param FormInterface $container
  * @throws InvalidVariableException
  * @return void
  */
 protected static function setContainerInRenderingContext(RenderingContextInterface $renderingContext, FormInterface $container)
 {
     $renderingContext->getViewHelperVariableContainer()->addOrUpdate(static::SCOPE, static::SCOPE_VARIABLE_CONTAINER, $container);
     if (TRUE === $renderingContext->getTemplateVariableContainer()->exists(static::SCOPE_VARIABLE_CONTAINER)) {
         $renderingContext->getTemplateVariableContainer()->remove(static::SCOPE_VARIABLE_CONTAINER);
     }
     $renderingContext->getTemplateVariableContainer()->add(static::SCOPE_VARIABLE_CONTAINER, $container);
 }
开发者ID:busynoggin,项目名称:flux,代码行数:14,代码来源:AbstractFormViewHelper.php

示例9: renderStatic

 /**
  * Default implementation for CompilableInterface. See CompilableInterface
  * for a detailed description of this method.
  *
  * @param array $arguments
  * @param \Closure $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  * @return mixed
  * @see \TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $viewHelperVariableContainer = $renderingContext->getViewHelperVariableContainer();
     $stackValue = array('expression' => $arguments['expression'], 'break' => false);
     if ($viewHelperVariableContainer->exists(SwitchViewHelper::class, 'stateStack')) {
         $stateStack = $viewHelperVariableContainer->get(SwitchViewHelper::class, 'stateStack');
     } else {
         $stateStack = array();
     }
     $stateStack[] = $stackValue;
     $viewHelperVariableContainer->addOrUpdate(SwitchViewHelper::class, 'stateStack', $stateStack);
     $result = $renderChildrenClosure();
     $stateStack = $viewHelperVariableContainer->get(SwitchViewHelper::class, 'stateStack');
     array_pop($stateStack);
     $viewHelperVariableContainer->addOrUpdate(SwitchViewHelper::class, 'stateStack', $stateStack);
     return $result;
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:27,代码来源:SwitchViewHelper.php


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