PHP 클래스 Neos\FluidAdaptor\Core\ViewHelper\AbstractConditionViewHelper

또한 보기: Neos\FluidAdaptor\Core\Parser\SyntaxTree\ViewHelperNode::convertArgumentValue() to find see how boolean arguments are evaluated = Usage = To create a custom Condition ViewHelper, you need to subclass this class, and implement your own render() method. Inside there, you should call $this->renderThenChild() if the condition evaluated to TRUE, and $this->renderElseChild() if the condition evaluated to FALSE. Every Condition ViewHelper has a "then" and "else" argument, so it can be used like: <[aConditionViewHelperName] .... then="condition true" else="condition false" />, or as well use the "then" and "else" child nodes.
또한 보기: Neos\FluidAdaptor\ViewHelpers\IfViewHelper for a more detailed explanation and a simple usage example. Make sure to NOT OVERRIDE the constructor.
상속: extends AbstractViewHelper
파일 보기 프로젝트 열기: neos/flow-development-collection 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$escapeOutput boolean

공개 메소드들

메소드 설명
compile ( string $argumentsName, string $closureName, string &$initializationPhpCode, TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\ViewHelperNode $node, TYPO3Fluid\Fluid\Core\Compiler\TemplateCompiler $compiler ) : string The compiled ViewHelper adds two new ViewHelper arguments: __thenClosure and __elseClosure.
initializeArguments ( ) Initializes the "then" and "else" arguments
renderStatic ( array $arguments, Closure $renderChildrenClosure, TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface $renderingContext ) : mixed

보호된 메소드들

메소드 설명
evaluateCondition ( array | null $arguments = null, TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface $renderingContext ) : boolean Static method which can be overridden by subclasses. If a subclass requires a different (or faster) decision then this method is the one to override and implement.
evaluateElseClosures ( array $closures, array $conditionClosures, TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface $renderingContext ) : string
renderElseChild ( ) : string Returns value of "else" attribute.
renderResult ( boolean $isConditionFullfilled, array $arguments, TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface $renderingContext ) : string
renderThenChild ( ) : mixed Returns value of "then" attribute.

메소드 상세

compile() 공개 메소드

These contain closures which are be executed to render the then(), respectively else() case.
public compile ( string $argumentsName, string $closureName, string &$initializationPhpCode, TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\ViewHelperNode $node, TYPO3Fluid\Fluid\Core\Compiler\TemplateCompiler $compiler ) : string
$argumentsName string
$closureName string
$initializationPhpCode string
$node TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\ViewHelperNode
$compiler TYPO3Fluid\Fluid\Core\Compiler\TemplateCompiler
리턴 string

evaluateCondition() 보호된 정적인 메소드

Note: method signature does not type-hint that an array is desired, and as such, *appears* to accept any input type. There is no type hint here for legacy reasons - the signature is kept compatible with third party packages which depending on PHP version would error out if this signature was not compatible with that of existing and in-production subclasses that will be using this base class in the future. Let this be a warning if someone considers changing this method signature!
protected static evaluateCondition ( array | null $arguments = null, TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface $renderingContext ) : boolean
$arguments array | null
$renderingContext TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface
리턴 boolean

evaluateElseClosures() 보호된 정적인 메소드

protected static evaluateElseClosures ( array $closures, array $conditionClosures, TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface $renderingContext ) : string
$closures array
$conditionClosures array
$renderingContext TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface
리턴 string

initializeArguments() 공개 메소드

Initializes the "then" and "else" arguments
public initializeArguments ( )

renderElseChild() 보호된 메소드

If else attribute is not set, iterates through child nodes and renders ElseViewHelper. If else attribute is not set and no ElseViewHelper is found, an empty string will be returned.
protected renderElseChild ( ) : string
리턴 string rendered ElseViewHelper or an empty string if no ThenViewHelper was found

renderResult() 보호된 정적인 메소드

protected static renderResult ( boolean $isConditionFullfilled, array $arguments, TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface $renderingContext ) : string
$isConditionFullfilled boolean
$arguments array
$renderingContext TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface
리턴 string

renderStatic() 공개 정적인 메소드

public static renderStatic ( array $arguments, Closure $renderChildrenClosure, TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface $renderingContext ) : mixed
$arguments array
$renderChildrenClosure Closure
$renderingContext TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface
리턴 mixed

renderThenChild() 보호된 메소드

If then attribute is not set, iterates through child nodes and renders ThenViewHelper. If then attribute is not set and no ThenViewHelper and no ElseViewHelper is found, all child nodes are rendered
protected renderThenChild ( ) : mixed
리턴 mixed rendered ThenViewHelper or contents of if no ThenViewHelper was found

프로퍼티 상세

$escapeOutput 보호되어 있는 프로퍼티

protected bool $escapeOutput
리턴 boolean