function openlayers_ui_object_delete_submit in Openlayers 6.2
Form Submit Callback for Preset Delete Form
File
- modules/
openlayers_ui/ openlayers_ui.module, line 477
Code
function openlayers_ui_object_delete_submit($form, &$form_state) {
$type = $form_state['values']['type'];
$object = $form_state['values']['object'];
switch ($type) {
case 'styles':
$result = openlayers_style_delete($object);
break;
case 'layers':
$result = openlayers_layer_delete($object);
break;
case 'presets':
$result = openlayers_preset_delete($object);
break;
}
// Check query results
if ($result) {
drupal_set_message(t('%name was deleted.', array(
'%name' => $object->name,
)));
}
else {
drupal_set_message(t('Error when attempting to delete %name.', array(
'%name' => $object->name,
)), 'error');
}
// Redirect
$form_state['redirect'] = 'admin/build/openlayers/' . $type;
}