You are here

function clientside_validation_form_after_build in Clientside Validation 7.2

Same name and namespace in other branches
  1. 8.2 clientside_validation.module \clientside_validation_form_after_build()
  2. 8 clientside_validation.module \clientside_validation_form_after_build()
  3. 6 clientside_validation.module \clientside_validation_form_after_build()
  4. 7 clientside_validation.module \clientside_validation_form_after_build()
  5. 3.0.x clientside_validation.module \clientside_validation_form_after_build()
  6. 2.0.x clientside_validation.module \clientside_validation_form_after_build()

Regular form.

1 string reference to 'clientside_validation_form_after_build'
clientside_validation_form_alter in ./clientside_validation.module
Implements hook_form_alter().

File

./clientside_validation.module, line 330
Add client side validation to forms.

Code

function clientside_validation_form_after_build(&$form, &$form_state) {
  clientside_validation_settings_current_form($form['#clientside_validation_settings']);
  $validation_added = clientside_validation_form_after_build_recurse($form['#id'], $form, $form_state);
  if ($validation_added) {
    $settings = array();
    _clientside_validation_add_general_settings($settings, $form);
    if (variable_get('clientside_validation_add_js_timing', 0)) {

      // @see http://remysharp.com/2007/04/20/performance-profiling-javascript/
      $form['#attached']['js'][] = drupal_get_path('module', 'clientside_validation') . '/js/time.js';
    }
    $form['#attached']['libraries_load'][] = array(
      'clientside.validation',
    );
    $form['#attached']['js'][] = array(
      'data' => $settings,
      'type' => 'setting',
    );
  }
  return $form;
}