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
Not an issue, but excited to share I finally figured out how to make a dropdown inside a matrix field that gets populated with the IDs of sibling blocks:
{# Get ID of entry currently editing #}
{% setsegment=craft.app.request.getSegment(3)|split('-') %}
{% settheEntryId=segment[0] %}
{# Query the entry and loop through its matrix field, if populated #}
{% settheEntry=craft.entries.id(theEntryId).one() %}
{% iftheEntry.matrixField|length %}
{% forblockintheEntry.matrixField %}
{{ loop.index>1?',' }} {
"value":"{{block.id}}",
"label":"{{block.siblingBlockLabelFriendlyField}}"
}
{% endfor %}
{% endif %}
This isn't much of an issue, but it took me a little bit to figure out. I'm not sure if it is mentioned explicitly anywhere in your readme, but I was only able to fix an "invalid foreach argument" error by including the {{ loop.index > 1 ? ',' }} bit before the value/label block inside a for loop that I finally noticed in some of your examples. Maybe a nod to that for dynamic fields within a loop?
Anyway, awesome plugin!!
The text was updated successfully, but these errors were encountered:
This is weird, when I print the field, {{ block.replaces }}, it returns the length of the stored string, which after dumping it I can tell is the correct block id.
Why is it printing the length of the string and not the string itself? Hmm
Update:
Wow, I don't know what's going on, but I deleted my dump() stuff and now it's printing out the actual id of the selected block... No idea what I did. I think it's time for a break, lol!
Not an issue, but excited to share I finally figured out how to make a dropdown inside a matrix field that gets populated with the IDs of sibling blocks:
This isn't much of an issue, but it took me a little bit to figure out. I'm not sure if it is mentioned explicitly anywhere in your readme, but I was only able to fix an "invalid foreach argument" error by including the
{{ loop.index > 1 ? ',' }}
bit before the value/label block inside afor
loop that I finally noticed in some of your examples. Maybe a nod to that for dynamic fields within a loop?Anyway, awesome plugin!!
The text was updated successfully, but these errors were encountered: