You are here

function _jammer_generic_admin_settings_submit in Jammer 7

Same name and namespace in other branches
  1. 6 jammer_generic.module \_jammer_generic_admin_settings_submit()

Implementation of submit for form.

File

./jammer_generic.module, line 100
Remove configured form elements from forms.

Code

function _jammer_generic_admin_settings_submit($form, &$form_state) {
  $form_values = $form_state['values'];
  if ($form_values['jammer_generic_form_id'] == '-jammer-generic-admin-settings') {
    drupal_set_message(t('You cannot jam elements of the generic jammer form.'));
    return;
  }
  $current_settings = variable_get('jammer_generic_elements', array());
  foreach ($current_settings as $key => $value) {
    if ($value['jammer_generic_form_id'] == $form_values['jammer_generic_form_id'] && $value['jammer_generic_element_id'] == $form_values['jammer_generic_element_id']) {
      drupal_set_message(t('Setting saved.'));

      // Setting was already set, not going to repeat it.
      return;
    }
  }
  $current_settings[] = array(
    'jammer_generic_form_id' => $form_values['jammer_generic_form_id'],
    'jammer_generic_element_id' => $form_values['jammer_generic_element_id'],
  );
  variable_set('jammer_generic_elements', $current_settings);
  drupal_set_message(t('Setting saved.'));
}