function webform_form_alter in Webform 7.4
Same name and namespace in other branches
- 8.5 includes/webform.form_alter.inc \webform_form_alter()
- 5.2 webform.module \webform_form_alter()
- 6.3 webform.module \webform_form_alter()
- 6.2 webform.module \webform_form_alter()
- 7.3 webform.module \webform_form_alter()
- 6.x includes/webform.form_alter.inc \webform_form_alter()
Implements hook_form_alter().
File
- ./
webform.module, line 1911 - This module provides a simple way to create forms and questionnaires.
Code
function webform_form_alter(&$form, $form_state, $form_id) {
if (isset($form['#node']->type) && $form_id == $form['#node']->type . '_node_form' && variable_get('webform_node_' . $form['#node']->type, FALSE)) {
$node = $form['#node'];
// Preserve all Webform options currently set on the node.
$form['webform'] = array(
'#type' => 'value',
'#value' => $node->webform,
);
// If a new node, redirect the user to the components form after save.
if (empty($node->nid) && in_array($node->type, webform_variable_get('webform_node_types_primary'))) {
$form['actions']['submit']['#submit'][] = 'webform_form_submit';
}
}
}