You are here

function ais_admin_settings_submit in Adaptive Image Styles (ais) 7

Handles AIS admin page submittions

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

File

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

Code

function ais_admin_settings_submit(&$form, &$form_state) {
  $ais = array();
  $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])) {
        $ais[] = array(
          'name' => $name,
          'size' => $form_state['values'][$namesize],
        );
      }
    }
  }
  variable_set("ais_adaptive_styles", $ais);
  if (isset($form_state['values']['aischoose']) and ($form_state['values']['aischoose'] == 'both-max' or $form_state['values']['aischoose'] == 'both-min' or $form_state['values']['aischoose'] == 'width' or $form_state['values']['aischoose'] == 'height')) {
    variable_set("ais_adaptive_styles_method", $form_state['values']['aischoose']);
  }
  drupal_set_message(t('The configuration options have been saved.'));
}