You are here

function ais_admin_settings_validate in Adaptive Image Styles (ais) 7

Validates AIS Admin form submittions

1 string reference to 'ais_admin_settings_validate'
ais_admin_settings in ./ais.admin.inc
Generates the AIS administration form

File

./ais.admin.inc, line 100
Administrative forms for Adaptive Image Styles.

Code

function ais_admin_settings_validate(&$form, &$form_state) {
  $styles = image_styles();
  foreach ($styles as $is) {
    if ($is['name'] == 'adaptive') {
      continue;
    }
    $name = $is['name'];
    $nameset = $name . "_set";
    $namesize = $name . "_size";
    if (isset($form_state['values'][$name]) and $form_state['values'][$name]) {
      if (!isset($form_state['values'][$namesize]) and !is_numeric($form_state['values'][$namesize]) and $form_state['values'][$namesize] > 0) {
        form_set_error('width', t('You must select valid width in pixels for style %style', array(
          '%style' => $name,
        )));
      }
    }
  }
}