Skip to content

RFC fields inside a set inside a collection can't be named "name" #1111

Open
@eduardomart

Description

@eduardomart

I believe this is related to: #1025

sidebar:
    ...
    fields:
        socialnetworks:
            label: "Social Networks"
            type: collection
            fields:
                socialnetwork:   # <----------------- this is always the output of 'name'
                    type: set
                    label: Social Network
                    fields:
                        name:        # <------------------ this can't be accessed, unless it's renamed to something else
                            label: Name
                            type: text
                        icon:
                            label: Icon
                            type: text
                        link:
                            label: Link
                            type: text
            group: content
   ...
  singleton: true

And you try to iterate the 'socialnetworks':

{% set content sn = 'contenttype' %}

{% for item in sn.socialnetworks %}
   {{ item.name }}
{% endfo%}

you will always get "socialnetwork" output in each iteration, however if you rename the text field "name" to something different like "title" then you get the actual value of the text field.

I think this needs to be clarified still in the docs, or maybe make a note that "name" shouldn't be used inside collection fields...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions