Array with images? #4107
Replies: 2 comments 2 replies
-
I'm not sure I fully understand what you are asking. I think you want to create a widget that can have multiple fields through an array, and one of those fields is an image. Is this generally correct? |
Beta Was this translation helpful? Give feedback.
-
Something like this should work:
{% for item in widget.arrayFieldNameHere %}
{# Can also access other properties of "item" here if you want #}
{% area item, "imageWidgetAreaNameHere" %}
{% endfor %}
And should permit in-context editing.
…On Fri, Mar 24, 2023 at 12:17 PM Robert Means ***@***.***> wrote:
I'm not sure I fully understand what you are asking. I think you want to
create a widget that can have multiple fields through an array, and one of
those fields is an image. Is this generally correct?
I would have to see some code to understand how you were using the area
option.
For the attachment, be aware that this will bring the image in without the
normal editing. This may be okay for your use-case.
Another way that could be used is through a relationship
<https://v3.docs.apostrophecms.org/guide/media.html#the-relationship-field-option>.
Once you land on the method you want to use I can help with the HTML output.
Sharing some minimal code would help me to make sure I understand.
Cheers,
Bob
—
Reply to this email directly, view it on GitHub
<#4107 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAH27OY22G4GEXE44ZEJITW5XCJBANCNFSM6AAAAAAWGWSK5A>
.
You are receiving this because you are subscribed to this thread.Message
ID: <apostrophecms/apostrophe/repo-discussions/4107/comments/5420426@
github.com>
--
THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER
APOSTROPHECMS | apostrophecms.com | he/him/his
|
Beta Was this translation helpful? Give feedback.
-
Sorry for potentially a silly question. I'm trying to have an image within each array entry and have that displayed on the site.
I've set up the field schema for my widget that contains an array and within the array, I'm trying to add a field to hold an image to each entry.
I had originally set it up the field as an area with an image widget, but I don't know how to show that image in the widget.html for the array element.
I then tried to set it as an attachment but again, not quite sure how to have that show up in the widget.html
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions