You are here

function units_admin_settings_submit in Units of Measurement 6

Submit callback for units admin settings form.

1 string reference to 'units_admin_settings_submit'
units_admin_settings in ./units.admin.inc
Units configuration form

File

./units.admin.inc, line 51
Units admin UI.

Code

function units_admin_settings_submit($form, &$form_state) {
  $units = units_get_units();
  $enabled = array();
  foreach ($units as $id => $unit) {
    if (isset($form_state['values']['enable_' . $id]) && $form_state['values']['enable_' . $id] == 1) {
      $enabled[] = $id;
    }
  }
  variable_set('units_enabled_units', $enabled);
  drupal_set_message(t('Enabled units list has been saved.'));
  $form_state['redirect'] = 'admin/content/units';
}