Example #1
0
 /**
  * Constructor.
  *
  * @param RenderingContextInterface $renderingContext a RenderingContext, provided by invoker
  * @param string $namespace the namespace identifier of the ViewHelper.
  * @param string $identifier the name of the ViewHelper to render, inside the namespace provided.
  * @param NodeInterface[] $arguments Arguments of view helper - each value is a RootNode.
  * @param ParsingState $state
  */
 public function __construct(RenderingContextInterface $renderingContext, $namespace, $identifier, array $arguments, ParsingState $state)
 {
     $resolver = $renderingContext->getViewHelperResolver();
     $this->arguments = $arguments;
     $this->viewHelperClassName = $resolver->resolveViewHelperClassName($namespace, $identifier);
     $this->uninitializedViewHelper = $resolver->createViewHelperInstanceFromClassName($this->viewHelperClassName);
     $this->uninitializedViewHelper->setRenderingContext($renderingContext);
     $this->uninitializedViewHelper->setViewHelperNode($this);
     $this->argumentDefinitions = $resolver->getArgumentDefinitionsForViewHelper($this->uninitializedViewHelper);
     $this->rewriteBooleanNodesInArgumentsObjectTree($this->argumentDefinitions, $this->arguments);
     $this->validateArguments($this->argumentDefinitions, $this->arguments);
 }
Example #2
0
 /**
  * Constructor.
  *
  * @param RenderingContextInterface $renderingContext a RenderingContext, provided by invoker
  * @param string $namespace the namespace identifier of the ViewHelper.
  * @param string $identifier the name of the ViewHelper to render, inside the namespace provided.
  * @param NodeInterface[] $arguments Arguments of view helper - each value is a RootNode.
  * @param ParsingState $state
  */
 public function __construct(RenderingContextInterface $renderingContext, $namespace, $identifier, array $arguments, ParsingState $state)
 {
     $resolver = $renderingContext->getViewHelperResolver();
     $this->arguments = $arguments;
     $this->viewHelperClassName = $resolver->resolveViewHelperClassName($namespace, $identifier);
     $this->uninitializedViewHelper = $resolver->createViewHelperInstanceFromClassName($this->viewHelperClassName);
     $this->uninitializedViewHelper->setViewHelperNode($this);
     // Note: RenderingContext required here though replaced later. See https://github.com/TYPO3Fluid/Fluid/pull/93
     $this->uninitializedViewHelper->setRenderingContext($renderingContext);
     $this->argumentDefinitions = $resolver->getArgumentDefinitionsForViewHelper($this->uninitializedViewHelper);
     $this->rewriteBooleanNodesInArgumentsObjectTree($this->argumentDefinitions, $this->arguments);
     $this->validateArguments($this->argumentDefinitions, $this->arguments);
 }
Example #3
0
 /**
  * @param ViewHelperInterface $viewHelper
  * @return void
  */
 protected function injectDependenciesIntoViewHelper(ViewHelperInterface $viewHelper)
 {
     $viewHelper->setRenderingContext($this->renderingContext);
     $viewHelper->setArguments($this->arguments);
     // this condition is needed, because the (Be)/Security\*ViewHelper don't extend the
     // AbstractViewHelper and contain no method injectReflectionService()
     if ($viewHelper instanceof AbstractViewHelper) {
         $reflectionServiceProphecy = $this->prophesize(ReflectionService::class);
         $viewHelper->injectReflectionService($reflectionServiceProphecy->reveal());
     }
 }