Created
September 2, 2014 11:20
-
-
Save ChezFre/c1d27db85a99b126052e to your computer and use it in GitHub Desktop.
Replace node id with other field from referenced node
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Berghoff2014_form_alter(&$form, &$form_state, $form_id) { | |
| if( $form_id === "webform_client_form_33" ) { | |
| /** | |
| ** Replace NID from Agent with actual email ** | |
| **/ | |
| //$node_id = $form['submitted']['agent']['#value']; | |
| $node_id = arg(1); | |
| //$agent = node_load($node_id); | |
| $agent = node_load( $node_id ); | |
| $form['submitted']['agent']['#value'] = $agent->field_email['und'][0]['email']; | |
| } | |
| if( $form_id === "webform_client_form_34" ) { | |
| $taxonomy_id = arg(1); | |
| $country = taxonomy_term_load( $taxonomy_id ); | |
| $form['submitted']['country']['#value'] = $country->name; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment