I have two content types, the first is Homepage and the second is SLider.
The Slider content type has multiple fields like title, ink, and image.
In the homepage content type, I have an entity reference field referring to the slider content type with multiple selections. I've created a template in my custom theme as node--home-page.html
and want to get the sliders fields values, All is okay with me except the image. I cannot get the image URL.
My code:-
{% for slide in node.field_hoeme_slideshows %}
{{ kint(slide.entity.field_home_slide_cta.uri) }} {# This is working #}
{{ kint(slide.entity.title.value) }} {# This is working #}
{{ kint(slide.entity.field_home_slide_snippet.value) }} {# This is working #}
{{ kint(slide.entity.field_home_slide_image) }} {# ****** This is not working *****#}
{% endfor %}
{{ slide.entity.field_home_slide_image }}
should print the entire<img>
tag, including responsive styles, if configured. – Hudri Oct 11 '17 at 12:57Exception: Object of type Drupal\file\Plugin\Field\FieldType\FileFieldItemList cannot be printed. in Drupal\Core\Template\TwigExtension->escapeFilter() (line 465 of core\lib\Drupal\Core\Template\TwigExtension.php).
– Mohamed Osama Gbril Oct 11 '17 at 16:38