You are here

function hook_openlayers_styles in Openlayers 6.2

Same name and namespace in other branches
  1. 7.2 docs/openlayers.api.php \hook_openlayers_styles()

OpenLayers Styles

This hook tells OpenLayers about the available styles that can be used in maps.

Ensure that you are telling CTools about this as well.

Return value

Return an associative array with index being a unique string identifier, and simple objects with the following properties:

  • "api_version":
  • "name":
  • "title":
  • "data":

See also

openlayers_example_ctools_plugin_api().

3 functions implement hook_openlayers_styles()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

openlayers_openlayers_styles in ./openlayers.module
Implementation of hook_openlayers_styles().
openlayers_test_features_openlayers_styles in tests/openlayers_test_features/openlayers_test_features.openlayers_styles.inc
Implementation of hook_openlayers_styles().
theme_openlayers_styles in includes/openlayers.theme.inc
Theme function to be able to override styles

File

docs/openlayers.api.php, line 213
Hooks provided by the OpenLayers suite of modules. This file allows hooks to be documented automatically with Doxygen, like on api.drupal.org.

Code

function hook_openlayers_styles() {

  // Taken from openlayers.styles.inc
  $styles = array();
  $style = new stdClass();
  $style->api_version = 1;
  $style->name = 'default';
  $style->title = t('Default style');
  $style->description = t('Basic default style.');
  $style->data = array(
    'pointRadius' => '5',
    'fillColor' => '#FFCC66',
    'strokeColor' => '#FF9933',
    'strokeWidth' => '4',
    'fillOpacity' => '0.5',
  );
  $styles[$style->name] = $style;
  return $styles;
}