You are here

function openlayers_features_revert in Openlayers 6

Implementation of hook_features_revert().

Parameters

$module: name of module to revert content for

File

includes/openlayers.features.inc, line 105
OpenLayers Features Support

Code

function openlayers_features_revert($module = NULL) {

  // Get all presets defined in this feature
  if (module_hook($module, 'openlayers_presets')) {
    $default_presets = module_invoke($module, 'openlayers_presets');

    // Get all DB defined presets
    $current_presets = openlayers_get_presets();

    // update all presets to their default values
    foreach ($default_presets as $default_preset) {
      foreach ($current_presets as $current_preset) {
        if ($current_preset['presetname'] == $default_preset['presetname']) {
          openlayers_delete_preset($current_preset);
        }
      }
    }
  }
  else {
    drupal_set_message(t('Could not load default OpenLayers presets.'), 'error');
    return FALSE;
  }
  return TRUE;
}