/** * @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); } }
/** * @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')); }
/** * @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); }
/** * @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'); }
/** * @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); }
/** * @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); }
/** * @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); }
/** * @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); }
/** * 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); }
/** * @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); }
/** * 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); }
/** * @return void */ public function initializeArguments() { parent::initializeArguments(); $this->registerArgument('expression', 'mixed', 'Expression to switch', TRUE); }
/** * @return void */ public function initializeArguments() { parent::initializeArguments(); $this->registerArgument('map', 'array', 'Array that specifies which variables should be mapped to which alias', true); }
/** * @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); }
/** * @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(); }
/** * @return void */ public function initializeArguments() { parent::initializeArguments(); $this->registerArgument('subject', 'array', 'Countable subject, array or \\Countable'); }
/** * Initialize the arguments. * * @return void * @api */ public function initializeArguments() { parent::initializeArguments(); $this->registerArgument('string', 'string', 'String', FALSE, NULL); $this->registerArgument('suffix', 'string', 'Suffix'); }
/** * @return void */ public function initializeArguments() { parent::initializeArguments(); $this->registerArgument('path', 'string', 'The Path', true, null); $this->registerArgument('package', 'string', 'The Package', false, null); }
/** * Initialize the arguments. * * @return void * @api */ public function initializeArguments() { parent::initializeArguments(); $this->registerArgument('className', 'string', 'Classname', FALSE, NULL); }
/** * 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); }
/** * @return void */ public function initializeArguments() { parent::initializeArguments(); $this->registerArgument('value', 'mixed', 'Value to match in this case', TRUE); }
/** * 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); }
/** * @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); }
public function initializeArguments() { parent::initializeArguments(); $this->registerArgument('name', 'string', 'name of the block'); }
/** * @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()); }
/** * @return void */ public function initializeArguments() { parent::initializeArguments(); $this->registerArgument('typeOnly', 'boolean', 'If TRUE, debugs only the type of variables', FALSE, FALSE); }
/** * 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); }
/** * @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'); }