コード例 #1
0
 /**
  * @param AbstractViewHelper $viewHelper
  * @return void
  */
 protected function injectDependenciesIntoViewHelper(AbstractViewHelper $viewHelper)
 {
     $viewHelper->setRenderingContext($this->renderingContext);
     $viewHelper->setArguments($this->arguments);
     if ($viewHelper instanceof AbstractTagBasedViewHelper) {
         $viewHelper->injectTagBuilder($this->tagBuilder);
     }
 }
コード例 #2
0
ファイル: EscapeTest.php プロジェクト: typo3/fluid
 /**
  * @test
  */
 public function processReenablesEscapingInterceptorOnClosingViewHelperTagIfItWasDisabledBefore()
 {
     $interceptorPosition = InterceptorInterface::INTERCEPT_CLOSING_VIEWHELPER;
     $this->mockViewHelper->expects($this->any())->method('isOutputEscapingEnabled')->will($this->returnValue(false));
     $this->mockNode->expects($this->any())->method('getUninitializedViewHelper')->will($this->returnValue($this->mockViewHelper));
     $this->escapeInterceptor->_set('childrenEscapingEnabled', false);
     $this->escapeInterceptor->_set('viewHelperNodesWhichDisableTheInterceptor', [$this->mockNode]);
     $this->escapeInterceptor->process($this->mockNode, $interceptorPosition, $this->mockParsingState);
     $this->assertTrue($this->escapeInterceptor->_get('childrenEscapingEnabled'));
 }
コード例 #3
0
ファイル: DebugViewHelper.php プロジェクト: pschriner/Fluid
 /**
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('typeOnly', 'boolean', 'If TRUE, debugs only the type of variables', FALSE, FALSE);
     $this->registerArgument('levels', 'integer', 'Levels to render when rendering nested objects/arrays', FALSE, 5);
     $this->registerArgument('html', 'boolean', 'Render HTML. If FALSE, output is indented plaintext', FALSE, FALSE);
 }
コード例 #4
0
 /**
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('each', 'array', 'The array or \\SplObjectStorage to iterated over', TRUE);
     $this->registerArgument('as', 'string', 'The name of the iteration variable', TRUE);
     $this->registerArgument('groupBy', 'string', 'Group by this property', TRUE);
     $this->registerArgument('groupKey', 'string', 'The name of the variable to store the current group', FALSE, 'groupKey');
 }
コード例 #5
0
 /**
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('value', 'string', 'Value to format');
     $this->registerArgument('keepQuotes', 'boolean', 'If TRUE quotes will not be replaced (ENT_NOQUOTES)', FALSE, FALSE);
     $this->registerArgument('encoding', 'string', 'Encoding', FALSE, 'UTF-8');
     $this->registerArgument('doubleEncode', 'boolean', 'If FALSE html entities will not be encoded', FALSE, TRUE);
 }
コード例 #6
0
ファイル: ForViewHelper.php プロジェクト: pschriner/Fluid
 /**
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('each', 'array', 'The array or \\SplObjectStorage to iterated over', TRUE);
     $this->registerArgument('as', 'string', 'The name of the iteration variable', TRUE);
     $this->registerArgument('key', 'string', 'Variable to assign array key to', FALSE);
     $this->registerArgument('reverse', 'boolean', 'If TRUE, iterates in reverse', FALSE, FALSE);
     $this->registerArgument('iteration', 'string', 'The name of the variable to store iteration information (index, cycle, isFirst, isLast, isEven, isOdd)', FALSE, NULL);
 }
コード例 #7
0
ファイル: RenderViewHelper.php プロジェクト: bwaidelich/Fluid
 /**
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('section', 'string', 'Section to render - combine with partial to render section in partial', FALSE, NULL);
     $this->registerArgument('partial', 'string', 'Partial to render, with or without section', FALSE, NULL);
     $this->registerArgument('arguments', 'array', 'Array of variables to be transferred. Use {_all} for all variables', FALSE, array());
     $this->registerArgument('optional', 'boolean', 'If TRUE, considers the *section* optional. Partial never is.', FALSE, FALSE);
     $this->registerArgument('default', 'mixed', 'Value (usually string) to be displayed if the section or partial does not exist', FALSE, NULL);
 }
コード例 #8
0
ファイル: ForViewHelper.php プロジェクト: bwaidelich/Fluid
 /**
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('each', 'array', 'The array or \\SplObjectStorage to iterated over', TRUE);
     $this->registerArgument('as', 'string', 'The name of the iteration variable', TRUE);
     $this->registerArgument('key', 'string', 'Variable to assign array key to', TRUE);
     $this->registerArgument('reverse', 'boolean', 'If TRUE, iterates in reverse', FALSE, FALSE);
     $this->registerArgument('iteration', 'string', 'Name of iteration variable to assign', FALSE, NULL);
 }
コード例 #9
0
ファイル: TestViewHelper.php プロジェクト: pschriner/Fluid
 /**
  * Handle any additional comments by ignoring them
  *
  * @param array $arguments
  */
 public function handleAdditionalArguments(array $arguments)
 {
     $filtered = array();
     foreach ($arguments as $name => $value) {
         if (isset($this->argumentDefinitions[$name])) {
             $filtered[$name] = $value;
         }
     }
     parent::handleAdditionalArguments($filtered);
 }
コード例 #10
0
 /**
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('section', 'string', 'Section to render - combine with partial to render section in partial', false, null);
     $this->registerArgument('partial', 'string', 'Partial to render, with or without section', false, null);
     $this->registerArgument('arguments', 'array', 'Array of variables to be transferred. Use {_all} for all variables', false, []);
     $this->registerArgument('optional', 'boolean', 'If TRUE, considers the *section* optional. Partial never is.', false, false);
     $this->registerArgument('default', 'mixed', 'Value (usually string) to be displayed if the section or partial does not exist', false, null);
     $this->registerArgument('contentAs', 'string', 'If used, renders the child content and adds it as a template variable with this name for use in the partial/section', false, null);
 }
コード例 #11
0
ファイル: FieldViewHelper.php プロジェクト: jmverges/soup
 /**
  * Initialize the arguments.
  *
  * @return void
  * @api
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('name', 'string', 'Name of the field', FALSE, NULL);
     $this->registerArgument('control', 'string', 'Specifies the control to use to render this field', FALSE, 'Text');
     $this->registerArgument('value', 'mixed', 'Value of the form field', FALSE, NULL);
     $this->registerArgument('placeholder', 'mixed', 'Placeholder for the input', FALSE, NULL);
     $this->registerArgument('wrap', 'string', 'Specifies the wrap used to render the field', FALSE, 'Default');
     $this->registerArgument('class', 'string', 'control class', FALSE, 'form-control');
     $this->registerArgument('required', 'boolean', 'Specifies, if this form field is required', FALSE, FALSE);
     $this->registerArgument('arguments', 'array', 'additional arguments for the control', FALSE, array());
     $this->registerArgument('label', 'string', 'custom label for the field', FALSE, NULL);
 }
コード例 #12
0
ファイル: SwitchViewHelper.php プロジェクト: bwaidelich/Fluid
 /**
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('expression', 'mixed', 'Expression to switch', TRUE);
 }
コード例 #13
0
ファイル: AliasViewHelper.php プロジェクト: typo3/fluid
 /**
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('map', 'array', 'Array that specifies which variables should be mapped to which alias', true);
 }
コード例 #14
0
ファイル: CycleViewHelper.php プロジェクト: mbrodala/Fluid
 /**
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('values', 'array', 'The array or object implementing \\ArrayAccess (for example \\SplObjectStorage) to iterated over', FALSE);
     $this->registerArgument('as', 'strong', 'The name of the iteration variable', TRUE);
 }
コード例 #15
0
 /**
  * @return \TYPO3Fluid\Fluid\Core\ViewHelper\ArgumentDefinition[]
  * @throws \TYPO3Fluid\Fluid\Core\Parser\Exception
  */
 public function prepareArguments()
 {
     if (method_exists($this, 'registerRenderMethodArguments')) {
         $this->registerRenderMethodArguments();
     }
     return parent::prepareArguments();
 }
コード例 #16
0
 /**
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('subject', 'array', 'Countable subject, array or \\Countable');
 }
コード例 #17
0
ファイル: CutSuffixViewHelper.php プロジェクト: jmverges/soup
 /**
  * Initialize the arguments.
  *
  * @return void
  * @api
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('string', 'string', 'String', FALSE, NULL);
     $this->registerArgument('suffix', 'string', 'Suffix');
 }
コード例 #18
0
 /**
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('path', 'string', 'The Path', true, null);
     $this->registerArgument('package', 'string', 'The Package', false, null);
 }
コード例 #19
0
 /**
  * Initialize the arguments.
  *
  * @return void
  * @api
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('className', 'string', 'Classname', FALSE, NULL);
 }
コード例 #20
0
 /**
  * The compiled ViewHelper adds two new ViewHelper arguments: __thenClosure and __elseClosure.
  * These contain closures which are be executed to render the then(), respectively else() case.
  *
  * @param string $argumentsName
  * @param string $closureName
  * @param string $initializationPhpCode
  * @param ViewHelperNode $node
  * @param TemplateCompiler $compiler
  * @return string
  */
 public function compile($argumentsName, $closureName, &$initializationPhpCode, ViewHelperNode $node, TemplateCompiler $compiler)
 {
     $thenViewHelperEncountered = $elseViewHelperEncountered = false;
     foreach ($node->getChildNodes() as $childNode) {
         if ($childNode instanceof ViewHelperNode) {
             $viewHelperClassName = $childNode->getViewHelperClassName();
             if (substr($viewHelperClassName, -14) === 'ThenViewHelper') {
                 $thenViewHelperEncountered = true;
                 $childNodesAsClosure = $compiler->wrapChildNodesInClosure($childNode);
                 $initializationPhpCode .= sprintf('%s[\'__thenClosure\'] = %s;', $argumentsName, $childNodesAsClosure) . chr(10);
             } elseif (substr($viewHelperClassName, -14) === 'ElseViewHelper') {
                 $elseViewHelperEncountered = true;
                 $childNodesAsClosure = $compiler->wrapChildNodesInClosure($childNode);
                 $initializationPhpCode .= sprintf('%s[\'__elseClosures\'][] = %s;', $argumentsName, $childNodesAsClosure) . chr(10);
                 $arguments = $childNode->getArguments();
                 if (isset($arguments['if'])) {
                     // The "else" has an argument, indicating it has a secondary (elseif) condition.
                     // Compile a closure which will evaluate the condition.
                     $elseIfConditionAsClosure = $compiler->wrapViewHelperNodeArgumentEvaluationInClosure($childNode, 'if');
                     $initializationPhpCode .= sprintf('%s[\'__elseifClosures\'][] = %s;', $argumentsName, $elseIfConditionAsClosure) . chr(10);
                 }
             }
         }
     }
     if (!$thenViewHelperEncountered && !$elseViewHelperEncountered && !isset($node->getArguments()['then'])) {
         $initializationPhpCode .= sprintf('%s[\'__thenClosure\'] = %s;', $argumentsName, $closureName) . chr(10);
     }
     return parent::compile($argumentsName, $closureName, $initializationPhpCode, $node, $compiler);
 }
コード例 #21
0
ファイル: CaseViewHelper.php プロジェクト: pschriner/Fluid
 /**
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('value', 'mixed', 'Value to match in this case', TRUE);
 }
コード例 #22
0
 /**
  * Overrides a registered argument. Call this method from your ViewHelper subclass
  * inside the initializeArguments() method if you want to override a previously registered argument.
  *
  * @see registerArgument()
  *
  * @param string $name Name of the argument
  * @param string $type Type of the argument
  * @param string $description Description of the argument
  * @param boolean $required If TRUE, argument is required. Defaults to FALSE.
  * @param mixed $defaultValue Default value of argument
  * @return FluidAbstractViewHelper $this, to allow chaining.
  * @throws Exception
  * @api
  */
 protected function overrideArgument($name, $type, $description, $required = false, $defaultValue = null)
 {
     if (!array_key_exists($name, $this->argumentDefinitions)) {
         throw new Exception('Argument "' . $name . '" has not been defined, thus it can\'t be overridden.', 1279212461);
     }
     return parent::overrideArgument($name, $type, $description, $required, $defaultValue);
 }
コード例 #23
0
ファイル: PrintfViewHelper.php プロジェクト: mbrodala/Fluid
 /**
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('arguments', 'array', 'The arguments for vsprintf', FALSE, array());
     $this->registerArgument('value', 'string', 'String to format', FALSE, FALSE);
 }
コード例 #24
0
ファイル: BlockViewHelper.php プロジェクト: mia3/expose
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('name', 'string', 'name of the block');
 }
コード例 #25
0
ファイル: BlockViewHelper.php プロジェクト: jmverges/soup
 /**
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('partial', 'string', 'Partial to render, with or without section');
     $this->registerArgument('arguments', 'array', 'Array of variables to be transferred. Use {_all} for all variables', FALSE, array());
 }
コード例 #26
0
ファイル: DebugViewHelper.php プロジェクト: mbrodala/Fluid
 /**
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('typeOnly', 'boolean', 'If TRUE, debugs only the type of variables', FALSE, FALSE);
 }
コード例 #27
0
ファイル: NameViewHelper.php プロジェクト: jmverges/soup
 /**
  * Initialize the arguments.
  *
  * @return void
  * @api
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('prefix', 'string', 'Set Prefix', FALSE, NULL);
     $this->registerArgument('name', 'string', 'name to prefix', FALSE, NULL);
 }
コード例 #28
0
 /**
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('section', 'string', 'Section to render - combine with partial to render section in partial');
     $this->registerArgument('partial', 'string', 'Partial to render, with or without section');
     $this->registerArgument('delegate', 'string', 'Optional PHP class name of a permanent, included-in-app ParsedTemplateInterface implementation to override partial/section');
     $this->registerArgument('arguments', 'array', 'Array of variables to be transferred. Use {_all} for all variables', FALSE, array());
     $this->registerArgument('optional', 'boolean', 'If TRUE, considers the *section* optional. Partial never is.', FALSE, FALSE);
     $this->registerArgument('default', 'mixed', 'Value (usually string) to be displayed if the section or partial does not exist');
     $this->registerArgument('contentAs', 'string', 'If used, renders the child content and adds it as a template variable with this name for use in the partial/section');
 }