You are here

function commentformsettings_settings_validate in Node and Comments Form Settings 7.3

Same name and namespace in other branches
  1. 6.3 commentformsettings/commentformsettings.module \commentformsettings_settings_validate()
  2. 6.2 commentformsettings/commentformsettings.module \commentformsettings_settings_validate()
  3. 7.2 commentformsettings/commentformsettings.module \commentformsettings_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 'commentformsettings_settings_validate'
commentformsettings_form_alter in commentformsettings/commentformsettings.module
Implements hook_form_alter().

File

commentformsettings/commentformsettings.module, line 162

Code

function commentformsettings_settings_validate($form, &$form_state) {
  $path = drupal_get_path("module", "commentformsettings") . '/includes/';

  // Get all the elements defined in the function.
  $elements = commentformsettings_elements_validate();

  // Loop thought the array to build the function.
  foreach ($elements as $key) {
    include_once DRUPAL_ROOT . '/' . $path . 'validate_' . $key . '.inc';
    $function = '_validate_' . $key;
    if (function_exists($function)) {
      $function($form, $form_state);
    }
  }
}