webform_default_fields.form.inc in Webform Default Fields 6
Same filename and directory in other branches
Building forms
File
includes/webform_default_fields.form.incView source
<?php
/**
* @file
* Building forms
*/
/**
* An additional form submit handler for webform settings.
* Make sure to create default fields nodes for all content type that are webform-enabled.
*/
function webform_default_fields_form_webform_admin_settings_submit($form, $form_state) {
$reset = FALSE;
if ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {
$reset = TRUE;
}
$node_types = node_get_types();
foreach ($node_types as $type) {
$check_node = in_array($type->type, $form_state['values']['webform_node_types']);
if ($reset) {
if ($check_node && $type->type != WEBFORM_DEFAULT_FIELDS_DEFAUT_TYPE) {
_webform_default_fields_delete_container_node($type->type, FALSE);
}
_webform_default_fields_container_node(WEBFORM_DEFAULT_FIELDS_DEFAUT_TYPE);
}
else {
if ($check_node) {
_webform_default_fields_container_node($type->type, FALSE);
}
else {
_webform_default_fields_delete_container_node($type->type, FALSE);
}
}
}
menu_rebuild();
}
Functions
Name | Description |
---|---|
webform_default_fields_form_webform_admin_settings_submit | An additional form submit handler for webform settings. Make sure to create default fields nodes for all content type that are webform-enabled. |