I'm using Drupal 7. I have a content type called Widget. One of the custom fields is field_widget_position. When I did a <?php print_r($page); ?> in the template, I can see the key-value pair of field_widget_position buried deep in the array. Is there an easier way to get a handle on field_widget_position instead of typing <?php echo $page['somefield']['somefield2']['somefield3']['etc....']['field_widget_position']; ?>?

2 Answers 2


This is a bad solution.

The right solution is

render(field_view_field('node', $node, 'field_widget_position'));


render(field_view_field('node', $node, 'field_widget_position', array('label' => 'hidden')));

if you don't want to print a label.

See http://www.computerminds.co.uk/articles/rendering-drupal-7-fields-right-way for more info.


I found the answer.

  • 1
    More generically: $node->field_widget_position[$node->language][0]['value'] Commented Apr 10, 2012 at 10:10

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.