Hi, this is not a question directly related to wrappers delight, but I think someone in here can provide some insight.

Let's say I use a taxonomy for something.

When I submit a node form with this taxonomy, I want to perform an operation so I pass $form_state['values']['my_taxonomy'] to a function doStuff.

Later somehwere, I might load a node with this taxonomy and wish to perform the same operation, so I pass $node->field_my_taxonomy to the same function doStuff.

I have several functions that I use both on nodes and on form values... how can I use wrappers delight without duplicating code as there is no wrapper for form_state?

Should I make custom wrappers to objectify form_state values and share the functionality as traits between form state objects and wrapper delight objects?

Thanks for you time!

Comments

yogaf’s picture

How about using hook_node_presave instead so you can use same node wrapper?

odegard’s picture

Thanks, this seems to be the best solution. FFR, do not save the wrapper ref http://drupal.stackexchange.com/questions/83472/entity-metadata-wrapper-...

zengenuity’s picture

Status: Active » Closed (works as designed)