You are here

function parallax_bg_admin_form_submit in Parallax Background 7

1 string reference to 'parallax_bg_admin_form_submit'
parallax_bg_admin in ./parallax_bg.module
Callback function for admin setting.

File

./parallax_bg.module, line 179
Basic Module file.

Code

function parallax_bg_admin_form_submit($form, &$form_state) {

  // Exclude unnecessary elements.
  form_state_values_clean($form_state);
  $i = $form_state['triggers'];
  if (!strlen($form_state['values']['parallax_bg_settings']['triggers_fieldset']["trigger{$i}"]["element"])) {
    unset($form_state['values']['parallax_bg_settings']['triggers_fieldset']["trigger{$i}"]);
  }
  unset($form_state['values']['parallax_bg_settings']['triggers_fieldset']["parallax_bg_settings__triggers_fieldset__active_tab"]);
  foreach ($form_state['values'] as $key => $value) {
    if (is_array($value) && isset($form_state['values']['array_filter'])) {
      $value = array_keys(array_filter($value));
    }
    variable_set($key, $value);
  }
  drupal_set_message(t('The configuration options have been saved.'));
}