You are here

function openlayers_features_export in Openlayers 6

Implementation of hook_features_export().

File

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

Code

function openlayers_features_export($data, &$export, $module_name = '') {

  // Collect a module to preset map
  $map = array();
  $modules = module_implements('openlayers_presets');
  foreach ($modules as $module) {
    $presets = module_invoke($module, 'openlayers_presets');
    foreach ($presets as $preset) {
      $map[$preset['presetname']] = $module;
    }
  }
  foreach ($data as $preset) {

    // If another module provides this preset, add it as a dependency
    if (isset($map[$preset]) && $map[$preset] != $module_name) {
      $module = $map[$preset];
      $export['dependencies'][$module] = $module;
    }
    else {
      $export['features']['openlayers'][$preset] = $preset;
    }
  }
}