You are here

function openlayers_object_delete in Openlayers 7.2

Same name and namespace in other branches
  1. 6.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'

= 'map'

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_map_delete in ./openlayers.module
Delete a map object from the database.
openlayers_style_delete in ./openlayers.module
Delete a style object from the database.

File

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

Code

function openlayers_object_delete($ol_object, $type) {

  // Check for object or name
  $tables = array(
    'style' => 'openlayers_styles',
    'layer' => 'openlayers_layers',
    'map' => 'openlayers_maps',
  );
  if (is_object($ol_object) && isset($ol_object->name) && isset($tables[$type])) {
    $ol_object = $ol_object->name;
    return db_delete($tables[$type])
      ->condition('name', $ol_object)
      ->execute();
  }
}