Skip to content

Option "alias" for fields #473

@dreistromland-tj

Description

@dreistromland-tj

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions