You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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...
The text was updated successfully, but these errors were encountered:
@I-Valchev but this would only be the case for fields within collections, correct? because it seems regular fields can use the name name so I don't know if this might lead to confusion for users.
Essentially:
If there's a getX method in Content.php -> x cannot be the name of a field.
If there's a getY method in Field.php (and all methods from field classes) -> y cannot be the name of a field inside a collection/set.
I believe this is related to: #1025
And you try to iterate the 'socialnetworks':
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...
The text was updated successfully, but these errors were encountered: