Drupal 7 entityforms module: How to get value of a field with php?

3.7k views Asked by At

I am using the entityform module to capture some user submitted data http://drupal.org/project/entityform

I need to pull in some of the entity field values into one of my templates. I was trying to do this with some code that works for regular node fields..

<?php echo $node->field_title[$node->language]['value']; ?>

I've tried..

<?php echo $entity->field_title[$node->language]['value']; ?>

But that doesn't work. Anyone have any ideas on how I can accomplish this?

2

There are 2 answers

4
mmiles On
<?php
    $field_data = field_get_items('entityform',$entityform,'field_title');
    echo render(field_view_value('entityform',$entityform,'field_title',$field_data));
?>

field_get_items documentation , field_view_value documentation

0
Henry On

If you know the entityform_id of a submission, you can load it like this:

entity_load('entityform', $entityform_id);