I'm attempting to build custom template for specific content type. So, I created node--my-content-type.tpl.php and tried to write some text: it works! Ok, now I want to render my fields. I have $content['field_title'], field_author, field_cast (is a field collection) etc.

I need values of these fields, so I tried to assign some variables: $title = $content['field_title']['value'] etc, but it doesn't seem to work. I can only call render function to render these fields, but I want to format page in custom mode.

How can I get field info in order to use correct values? Thanks!

1 Answer 1


Download and enable the devel module to use dpm() on $content. This will show you the proper structure of the $content array. Sometimes entities and fields will have different structures depending on their type or how they're being implemented for that content type.

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.