I want to check the fields.field_image.content to see if it is empty or not. I want the view to display differently if there is no image in the page field_image field.
I was thinking I could just get the URL of the field_image and do a simple if statement, but I don't see a way to do that.
Is there to check if the fields.field_image.content field is empty?
I've tried a few different things like:
{% if fields.field_image.content is empty %}
{% if fields.field_image.content0|striptags|trim is empty %}
I'd like to dump fields.field_image to see the whole object, but my local setup always crashes.
Is this even possible?
The answer is yes it is possible to check if the image is present or not.
Here is how to do it:
{% set fieldimage = fields.field_image.content|render|striptags('<img>')|trim|length > 0 %}
{% if fieldimage == false %}
image is empty
{% else %}
image is not empty
{% endif %}