You are here

function openlayers_layer_type::save in Openlayers 6.2

Return value

Success value on saving this layer

File

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

Class

openlayers_layer_type
We define base classes in the core module. All other parent classes can be autoloaded through ctools.

Code

function save() {
  if (!empty($this->name)) {
    $exists = db_result(db_query("SELECT name FROM {openlayers_layers} WHERE name = '%s'", $this->name));

    // If this layer exists, specify that 'name' is
    // the primary key for the layer which will be updated
    return $exists ? drupal_write_record('openlayers_layers', $this
      ->to_record(), 'name') : drupal_write_record('openlayers_layers', $this
      ->to_record());
  }
}