You are here

function fancy_login_settings_validate in Fancy Login 7.2

Same name and namespace in other branches
  1. 6.2 includes/fancy_login.pages.inc \fancy_login_settings_validate()
  2. 6 fancy_login.module \fancy_login_settings_validate()
  3. 7.3 includes/fancy_login.pages.inc \fancy_login_settings_validate()

Validation function for the settings page

File

./fancy_login.pages.inc, line 152

Code

function fancy_login_settings_validate($form, &$form_state) {
  $test_values = array(
    'screen_fade_color' => 'Screen Fade Color',
    'screen_fade_z_index' => 'Screen Fade z-index',
    'login_box_width' => 'Login Box Width',
    'login_box_background_color' => 'login_box_background_color',
    'login_box_text_color' => 'login_box_text_color',
    'login_box_border_color' => 'login_box_border_color',
    'login_box_border_width' => 'login_box_border_width',
    'login_box_border_style' => 'Login Box Border Style',
  );
  foreach ($test_values as $machine => $human) {
    if ($form_state['values'][$machine] == '') {
      form_set_error($machine, t('!field must contain a value.', array(
        '!field' => $human,
      )));
    }
  }
  if (!is_numeric(trim($form_state['values']['fancy_login_dim_fade_speed']))) {
    form_set_error('fancy_login_dim_fade_speed', t('Background Fade Speed must contain a numeric value'));
  }
  if (!is_numeric(trim($form_state['values']['fancy_login_box_fade_speed']))) {
    form_set_error('fancy_login_box_fade_speed', t('Login Box Fade Speed must contain a numeric value'));
  }
}