function shorten_cs_edit_submit in Shorten URLs 8.2
Same name and namespace in other branches
- 8 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 82 - Provides the configuration page for Shorten URLs Custom Services.
Code
function shorten_cs_edit_submit($form, $form_state) {
$v = $form_state['values'];
$record = [];
foreach ([
'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::messenger()
->addStatus(t('The changes to service %service have been saved.', [
'%service' => $record['name'],
]));
$_GET['destination'] = 'admin/config/services/shorten/custom';
}