You are here

function openlayers_delete_preset in Openlayers 6

Parameters

$preset The name of the preset to be deleted:

Return value

None

1 call to openlayers_delete_preset()
openlayers_features_revert in includes/openlayers.features.inc
Implementation of hook_features_revert().

File

includes/openlayers.features.inc, line 78
OpenLayers Features Support

Code

function openlayers_delete_preset($preset) {
  $preset = openlayers_get_preset($preset, TRUE);
  if ($preset['type'] == OPENLAYERS_STORAGE_DEFAULT) {
    drupal_set_message(t('Cannot delete %name because it is provided by a module.', array(
      '%name' => $preset['preset_name'],
    )));
  }
  else {

    // Create query
    $query = "DELETE FROM {openlayers_map_presets} WHERE preset_id = %d";
    $result = db_query($query, $preset['preset_id']);

    // Check query results
    if ($result) {
      drupal_set_message(t('Preset %name was deleted.', array(
        '%name' => $preset['preset_name'],
      )));
    }
    else {
      drupal_set_message(t('Error when attempting to delete preset.'), 'error');
    }
  }
}