It would be nice to have an option to set an alias variable name for fields. This would make templating a bit more flexible when reusing fields.
Example:
I have an image field and want to reuse the image column. That means that I have to use data.image in the templates.
But I have a shared layout like that:
<div class="inner-wrap">
<f:render section="Main"/>
</div>
<f:if condition="{data.intro_image}">
<f:for each="{data.intro_image}" as="file">
<f:render partial="IntroImage" arguments="{file: file}"/>
</f:for>
</f:if>
That means, that only intro_images should be displayed there. I therefore cannot reuse the image column as using data.image in the layout would render the image for all content-blocks. With an alias, multiple content blocks could use the image column but use different variables in the templates.
Adding a new field intro_image is of course not much of work but it feels cleaner if I can reuse a column 😉
It's an edge case, I know. But maybe there are some more cases where an alias could be helpful.
It would be nice to have an option to set an alias variable name for fields. This would make templating a bit more flexible when reusing fields.
Example:
I have an image field and want to reuse the
imagecolumn. That means that I have to usedata.imagein the templates.But I have a shared layout like that:
That means, that only
intro_images should be displayed there. I therefore cannot reuse theimagecolumn as usingdata.imagein the layout would render theimagefor all content-blocks. With an alias, multiple content blocks could use theimagecolumn but use different variables in the templates.Adding a new field
intro_imageis of course not much of work but it feels cleaner if I can reuse a column 😉It's an edge case, I know. But maybe there are some more cases where an alias could be helpful.