this is going to be quick and direct. I’m trying to access different content results from a view related with a content type. I’m pretty much a newbie with twig, but I did make it work to access fields.
Example: Content Type: Books Fields: Name, Portrait(Image). Machine Name: field_name – field_image
Let’s say I upload 2 contents called Book 1 and Book 2 based on the content type.
What I want is to display all fields from Book 1 for the moment or Book 2 but not all of the content at the same time.
-First attempt: tried this line of code:
Works perfectly, it prints index 0 but not working printing the image, because instead it gives me the id.
-Second attempt: tried this line of code:
This one seems to be the most practical, it works showing the actual picture from the field image, but I dont know how to access only the image for one index(Book 1).
-Third attempt: tried this line of code
This one doesnt work for me at all.
Hopefully somebody would help me with this. Ive been struggling one week with this.