You are here

function openlayers_object_delete in Openlayers 6.2

Same name and namespace in other branches
  1. 7.2 openlayers.module \openlayers_object_delete()

Delete an object from the database.

Parameters

$ol_object: String identifier of an object or the object with name.

$type: Type of object to delete. The options are the following:

  • 'layer'
  • 'style'

= 'preset'

Return value

The results of the DB delete.

3 calls to openlayers_object_delete()
openlayers_layer_delete in ./openlayers.module
Delete a layer object from the database.
openlayers_preset_delete in ./openlayers.module
Delete a preset object from the database.
openlayers_style_delete in ./openlayers.module
Delete a style object from the database.

File

./openlayers.module, line 686
Main OpenLayers API File

Code

function openlayers_object_delete($ol_object, $type) {

  // Check for object or name
  if (is_object($ol_object) && isset($ol_object->name)) {
    $ol_object = $ol_object->name;
  }

  // Determine query to use
  switch ($type) {
    case 'style':
      $query = "DELETE FROM {openlayers_styles} WHERE name = '%s'";
      break;
    case 'layer':
      $query = "DELETE FROM {openlayers_layers} WHERE name = '%s'";
      break;
    case 'preset':
      $query = "DELETE FROM {openlayers_map_presets} WHERE name = '%s'";
      break;
    default:
      return FALSE;
  }
  return db_query($query, $ol_object);
}