Skip to content

Instantly share code, notes, and snippets.

@rubedell
Created August 29, 2013 08:15
Show Gist options
  • Save rubedell/6375470 to your computer and use it in GitHub Desktop.
Save rubedell/6375470 to your computer and use it in GitHub Desktop.
Webform block - copy node title to hidden field
function the_aim_custom_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
//apply for job form
case 'webform_client_form_38':
//get title of current node and insert into webform field
$current_object = menu_get_object();
if(isset($current_object->title)) {
$job_title = $current_object->title;
$form['submitted']['vacature']['#default_value'] = $job_title;
}
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment