You are here

function openlayers_preset_save in Openlayers 6.2

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

Save a preset object to the database.

Parameters

$preset: Preset object.

Return value

The results of DB write or FALSE if no name.

1 call to openlayers_preset_save()
openlayers_ui_presets_form_submit in modules/openlayers_ui/includes/openlayers_ui.presets.inc
Form submit for preset add form

File

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

Code

function openlayers_preset_save($preset) {
  if (!empty($preset->name)) {
    $exists = db_result(db_query("SELECT name FROM {openlayers_map_presets} \n      WHERE name = '%s'", $preset->name));
    return $exists ? drupal_write_record('openlayers_map_presets', $preset, 'name') : drupal_write_record('openlayers_map_presets', $preset);
  }
  return FALSE;
}