You are here

function stringoverrides_admin_submit in String Overrides 5

Same name and namespace in other branches
  1. 6 stringoverrides.admin.inc \stringoverrides_admin_submit()
  2. 7 stringoverrides.admin.inc \stringoverrides_admin_submit()

Triggered when the user submits the administration page

File

./stringoverrides.admin.inc, line 47
Admin page callbacks for the String Overrides module.

Code

function stringoverrides_admin_submit($form_id, $form_values) {

  // Format the words correctly so that they're put into the database correctly
  $words = array();
  foreach ($form_values['string'] as $index => $value) {
    if (!empty($value['original']) && $value['enabled']) {

      // Get rid of carriage returns.
      list($orig, $replace) = str_replace("\r", '', array(
        $value['original'],
        $value['replacement'],
      ));
      $words[$orig] = $replace;
    }
  }

  // Save into the English language definition
  variable_set('locale_custom_strings_en', $words);

  // Save the language name
  variable_set('stringoverrides_language', $form_values['language']);

  // Output a message to the user
  drupal_set_message(t('Your changes have been saved.'));
}