function shorten_cs_edit_submit in Shorten URLs 8
Same name and namespace in other branches
- 8.2 modules/shorten_cs/shorten_cs.admin.inc \shorten_cs_edit_submit()
- 6 shorten_cs.admin.inc \shorten_cs_edit_submit()
- 7.2 shorten_cs.admin.inc \shorten_cs_edit_submit()
- 7 shorten_cs.admin.inc \shorten_cs_edit_submit()
Submits the form to edit a service.
File
- modules/
shorten_cs/ shorten_cs.admin.inc, line 70 - 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::database()
->merge('shorten_cs')
->fields($record)
->key([
'sid',
])
->execute();
// @FIXME
// // @FIXME
// // This looks like another module's variable. You'll need to rewrite this call
// // to ensure that it uses the correct configuration object.
// if ($v['old_name'] == variable_get('shorten_service', 'is.gd')) {
// variable_set('shorten_service', $v['name']);
// }
// @FIXME
// // @FIXME
// // This looks like another module's variable. You'll need to rewrite this call
// // to ensure that it uses the correct configuration object.
// 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';
}