You are here

function shorten_cs_edit_submit in Shorten URLs 7

Same name and namespace in other branches
  1. 8.2 modules/shorten_cs/shorten_cs.admin.inc \shorten_cs_edit_submit()
  2. 8 modules/shorten_cs/shorten_cs.admin.inc \shorten_cs_edit_submit()
  3. 6 shorten_cs.admin.inc \shorten_cs_edit_submit()
  4. 7.2 shorten_cs.admin.inc \shorten_cs_edit_submit()

Submits the form to edit a service.

File

./shorten_cs.admin.inc, line 181
Provides the configuration page for Shorten URLs Custom Services.

Code

function shorten_cs_edit_submit($form, $form_state) {
  $v = $form_state['values'];
  $record = array();
  foreach (array(
    'name',
    'url',
    'type',
    'tag',
    'sid',
  ) as $key) {
    $record[$key] = $v[$key];
  }
  drupal_write_record('shorten_cs', $record, 'sid');
  if ($v['old_name'] == variable_get('shorten_service', 'is.gd')) {
    variable_set('shorten_service', $v['name']);
  }
  if ($v['old_name'] == variable_get('shorten_service_backup', 'TinyURL')) {
    variable_set('shorten_service', $v['name']);
  }
  drupal_set_message(t('The changes to service %service have been saved.', array(
    '%service' => $record['name'],
  )));
  $_GET['destination'] = 'admin/config/services/shorten/custom';
}