function nodeformsettings_settings_validate in Node and Comments Form Settings 6.2
Same name and namespace in other branches
- 6.3 nodeformsettings.module \nodeformsettings_settings_validate()
- 7.2 nodeformsettings.module \nodeformsettings_settings_validate()
We use this function to validate
The reason why we don't use '#element_validate' in each form field is because with this we have option to $form_state and with #element_validate we only have access to the element that calls que validation function
1 string reference to 'nodeformsettings_settings_validate'
- nodeformsettings_form_alter in ./
nodeformsettings.module - Implementation of hook_form_alter()
File
- ./
nodeformsettings.module, line 136 - main file, only one hook_form_alter to change several settings
Code
function nodeformsettings_settings_validate($form, &$form_state) {
$path = drupal_get_path("module", "nodeformsettings") . '/includes/';
// Get all the elements defined in the function
$elements = nodeformsettings_elements_validate();
// Loop thought the array to build the function
foreach ($elements as $key) {
include_once $path . 'validate_' . $key . '.inc';
$function = '_validate_' . $key;
if (function_exists($function)) {
$function($form, $form_state);
}
}
}