class IfHasErrorsViewHelper extends AbstractConditionViewHelper (View source)

This view helper allows to check whether validation errors adhere to the current request.

= Examples =

Please fill out all fields according to the description
```
You must provide a title.
```

Properties

protected RenderingContextInterface $renderingContext from  AbstractViewHelper
protected ControllerContext $controllerContext

Controller Context to use

from  AbstractViewHelper
protected ObjectManagerInterface $objectManager from  AbstractViewHelper
protected LoggerInterface $logger from  AbstractViewHelper
protected bool $escapeOutput from  AbstractConditionViewHelper

Methods

void
setRenderingContext(RenderingContextInterface $renderingContext)

No description

void
injectObjectManager(ObjectManagerInterface $objectManager)

No description

void
injectLogger(LoggerInterface $logger)

Injects the (system) logger based on PSR-3.

initializeArguments()

No description

static bool
evaluateCondition(array|null $arguments, RenderingContextInterface $renderingContext)

No description

static mixed
renderStatic(array $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)

No description

static string
evaluateElseClosures(array $closures, array $conditionClosures, RenderingContextInterface $renderingContext)

No description

mixed
renderThenChild()

Returns value of "then" attribute.

string
renderElseChild()

Returns value of "else" attribute.

string
compile(string $argumentsName, string $closureName, string $initializationPhpCode, ViewHelperNode $node, TemplateCompiler $compiler)

The compiled ViewHelper adds two new ViewHelper arguments: thenClosure and elseClosure.

static mixed
renderResult(bool $isConditionFullfilled, array $arguments, RenderingContextInterface $renderingContext)

No description

mixed
render()

Renders child if there are validation errors. The check can be narrowed down to specific property paths.

Details

void setRenderingContext(RenderingContextInterface $renderingContext)

No description

Parameters

RenderingContextInterface $renderingContext

Return Value

void

void injectObjectManager(ObjectManagerInterface $objectManager)

No description

Parameters

ObjectManagerInterface $objectManager

Return Value

void

void injectLogger(LoggerInterface $logger)

Injects the (system) logger based on PSR-3.

Parameters

LoggerInterface $logger

Return Value

void

bool isEscapingInterceptorEnabled()

No description

Return Value

bool

initializeArguments()

No description

Exceptions

Exception

static protected bool evaluateCondition(array|null $arguments, RenderingContextInterface $renderingContext)

No description

Parameters

array|null $arguments
RenderingContextInterface $renderingContext

Return Value

bool

static mixed renderStatic(array $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)

No description

Parameters

array $arguments
Closure $renderChildrenClosure
RenderingContextInterface $renderingContext

Return Value

mixed

static protected string evaluateElseClosures(array $closures, array $conditionClosures, RenderingContextInterface $renderingContext)

No description

Parameters

array $closures
array $conditionClosures
RenderingContextInterface $renderingContext

Return Value

string

protected mixed renderThenChild()

Returns value of "then" attribute.

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

Return Value

mixed

rendered ThenViewHelper or contents of if no ThenViewHelper was found

protected string renderElseChild()

Returns value of "else" attribute.

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.

Return Value

string

rendered ElseViewHelper or an empty string if no ThenViewHelper was found

string compile(string $argumentsName, string $closureName, string $initializationPhpCode, ViewHelperNode $node, TemplateCompiler $compiler)

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.

Parameters

string $argumentsName
string $closureName
string $initializationPhpCode
ViewHelperNode $node
TemplateCompiler $compiler

Return Value

string

static protected mixed renderResult(bool $isConditionFullfilled, array $arguments, RenderingContextInterface $renderingContext)

No description

Parameters

bool $isConditionFullfilled
array $arguments
RenderingContextInterface $renderingContext

Return Value

mixed

mixed render()

Renders child if there are validation errors. The check can be narrowed down to specific property paths.

If no errors are there, it renders the -child.

Return Value

mixed