[FEATURE] Introduce argument definitions for templates and partials#1063
Merged
[FEATURE] Introduce argument definitions for templates and partials#1063
Conversation
0cc6bdf to
9af58ae
Compare
s2b
commented
May 6, 2025
e15bdf9 to
b23659c
Compare
096323f to
ce52444
Compare
s2b
commented
May 7, 2025
3d97700 to
5798cfb
Compare
5798cfb to
060fabb
Compare
s2b
commented
May 7, 2025
060fabb to
456cdb7
Compare
The new `<f:argument>` ViewHelper allows to define an API
for templates, partials and layouts that will be validated when
the template/partial/layout is rendered. For each argument,
a type can be defined. By default, arguments are defined as
non-optional, but they can be defined as optional by using
`optional="{true}"`. Optional arguments can have default
values, which are defined with `default="my default value"`.
To avoid unnecessary complexity, the ViewHelper ensures that
no dynamic content (like variables) can be used in an argument
definition. Also, `<f:argument>` can't be nested into other
ViewHelpers.
Template argument definitions are processed and verified
by the new `StrictArgumentProcessor`, which properly
ensures argument types by casting scalar values and checking
the types more thoroughly than the `LenientArgumentProcessor`.
This means that currently template arguments are validated
in a different way than ViewHelper arguments, however
this will be resolved with Fluid v5.
Currently, there is no way to prohibit additional arguments
that are not defined with the `<f:argument>` ViewHelper,
however this might still be added in the future.
456cdb7 to
acda79f
Compare
lolli42
approved these changes
May 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The new
<f:argument>ViewHelper allows to define an APIfor templates, partials and layouts that will be validated when
the template/partial/layout is rendered. For each argument,
a type can be defined. By default, arguments are defined as
non-optional, but they can be defined as optional by using
optional="{true}". Optional arguments can have defaultvalues, which are defined with
default="my default value".To avoid unnecessary complexity, the ViewHelper ensures that
no dynamic content (like variables) can be used in an argument
definition. Also,
<f:argument>can't be nested into otherViewHelpers.
Template argument definitions are processed and verified
by the new
StrictArgumentProcessor, which properlyensures argument types by casting scalar values and checking
the types more thoroughly than the
LenientArgumentProcessor.This means that currently template arguments are validated
in a different way than ViewHelper arguments, however
this will be resolved with Fluid v5.
Currently, there is no way to prohibit additional arguments
that are not defined with the
<f:argument>ViewHelper,however this might still be added in the future.