2

In an entityform "form_alter" function I have $form_state with all the info inside I need. I could "hard-code" the language, but this is a multi language site... The information needed is at: $form_state['values']['field_myone']['en'][0]['value']

I'm aware of field_get_items or entity_metadata_wrapper, but I can't get either one to work.

This doesn't give me a wrapper back:

$wrap = entity_metadata_wrapper('entity_form', $form_state); 

And this one doesn't work either:

$val = field_get_items('entityform', $form_state, 'field_myone');

Any help out there?

Thanks!

1 Answer 1

0

I am also interested. Please post the answer if you solved.

This code:

$node = node_load($form_state['node']->nid;);
$node_wrapper = entity_metadata_wrapper('node', $node, array('bundle', $node->type));

solves in case you are editing a previously saved node (and the nid is then existing).

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.