I have a twig template for a custom content type. And it is able to render most fields just fine, but I am unable to print an image field with multiple images.
node--mycontenttype.html.twig contains
{{ content.field_mytitle }}
{{ content.field_myheaderimage }}
<div class="row expanded">
{% for galleryimage in content.field_gallery_images %}
<div class="gallery-image-item"> {{ galleryimage }} </div>
{% endfor %}
</div>
content.field_mytitle and content._field_myheaderimage outputs the title and image just fine. But when I use the for loop
{% for galleryimage in content.field_gallery_images %}
<div class="gallery-image-item"> {{ galleryimage }} </div>
{% endfor %}
I receive an error
Exception: Object of type Drupal\node\Entity\Node cannot be printed. in Drupal\Core\Template\TwigExtension->escapeFilter() (line 443 of core/lib/Drupal/Core/Template/TwigExtension.php).
When I just use
{{ content.field_gallery_images }}
It's able to output each image, but this does not allow me to wrap each item in divs and add content to each one.