Hi,

In my module I create a preview and a style using the export and the functions : openlayers_style_save($style), openlayers_preset_save($preset). But my problem is how can I delete this preset programmatically in the hook_uninstall ? I don't find any functions that seems to do that.

Thanks for your help.

Comments

zzolo’s picture

Title: Programmatically delete a preset or a style » Create API remove functions
Version: 6.x-2.0-alpha7 » 6.x-2.x-dev
Category: support » feature

There is no API function for deleting styles, presets, or layers. In the UI module, you can see it is done manually with a statement like:

      $result = db_query("DELETE FROM {openlayers_styles} WHERE name = '%s'", $object->name);

We should have these API functions available. I am updating the title and category of this ticket to reflect that.

zzolo’s picture

Status: Active » Fixed

Done. Added functions and even a couple tests:
http://drupal.org/cvs?commit=375094

sebgranel’s picture

Thank you for your help zzolo

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.