0

I have a 'Gallery' content type that has an entity reference field, which I use to reference other nodes of the 'Gallery Item' content type. When creating a 'Gallery' I use the nodeblock module to automatically create a block with this content.

So when I place this block in any page, let's say the homepage, I have it displaying the 'Gallery' title and a body on top, and below that, each 'gallery item' using the 'rendered entity' field formatter.

What I also need, is to somehow display the node id of each 'gallery item'.

I've tried editing the entity reference field template by creating a custom field.tpl.php template for it, but I can't find a way of accessing the node ID of each corresponding item.

Please help!

1 Answer 1

0

Found my solution! I was trying to access the node id from the field.tpl.php template because I wanted to add a CSS ID (using the node id) to the field outer wrapper (a div). Which was in this field template.

What I ended up doing was removing this div wrapper from the field template, and just adding the CSS id to the div wrapper in the node.tpl.php template.

Since I only needed this CSS id in certain a view mode, I created a node template for my specific view mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.