Behaviors are bundled functionality for maps. There are a number of behaviors available to maps, each with their own properties.
General Properties
- id
- Values:
- string
- Description:
- Identifier of the behavior.
- Example:
- 'behavior_type_id'
- type
- Values:
- string
- Description:
- The type of behavior which dictates the callbacks.
- Example:
- 'openlayers_behaviors_tooltip'
Tooltips
Example:
'behaviors' = array(
'openlayers_views_tooltip_id' = array(
'id' => 'openlayers_views_tooltip_id',
'type' => 'openlayers_behaviors_tooltip',
'layer' => 'layer_name',
'attribute' => 'openlayers_tooltip',
),
),
- layer
- Values:
- string
- Description:
- Which layer to assign this behavior to. This probably will be a Vector layer.
- Example:
- 'layer_name'
- attribute
- Values:
- string
- Description:
- The key of the attribute to use from the feature as the display text. See Features. This will be name by default.
- Example:
- 'name'
- attribute_id
- Values:
- string
- Description:
- The HTML identifier to be used for the the div around the text. Defaults to Map ID and 'tooltip-text'.
- Example:
- $map['id'] . '-tooltip-text'
- container_id
- Values:
- string
- Description:
- The HTML identifier to be used main tooltip div. Defaults to Map ID and 'tooltip-container'.
- Example:
- $map['id'] . '-tooltip-container'
- tooltip_id
- Values:
- string
- Description:
- The HTML identifier to be used main tooltip div. This is the div you should use for theming. Defaults to Map ID and 'tooltip'.
- Example:
- $map['id'] . '-tooltip'
- offset_top
- Values:
- integer or string
- Description:
- Pixels to offset tooltip from the top. May also use 'height' or 'width' to dynamically offset using the size of the container. Defaults to 'height'.
- Example:
- 10
- offset_left
- Values:
- integer or string
- Description:
- Pixels to offset tooltip from the left. May also use 'height' or 'width' to dynamically offset using the size of the container. Defaults to 0.
- Example:
- 12
Theming the tooltip
There are two ways to theme the tooltip. The first is simply using css. To do this override the css selector .openlayers-behaviors-tooltip
.
The second way to do this is to implement a theme override, this can be done by overriding theme_openlayers_behaviors_tooltip_container
.
Popups
Example:
'behaviors' = array(
'openlayers_views_popup' = array(
'id' => 'openlayers_views_popup',
'type' => 'openlayers_behaviors_popup',
'attribute' => 'openlayers_popup',
),
),
- attribute
- Values:
- string
- Description:
- The key of the attribute to use from the feature as the display text. See Features. This will be name by default.
- Example:
- 'name'
Draw Features
Zoom to Layer(s)
Cluster
Declutter
Fullscreen
This behavior displays a 'fullscreen' button that allows the map to be viewed fullscreen. Fullscreen mode can also be turned on by default, or locked fullscreen.
'behaviors' = array (
'some_id' = array (
'id' => 'some_id',
'type' => 'openlayers_behaviors_fullscreen',
'defaut' => 'on', // optional, assumes 'off' if ommited.
),
),
- default
- Values:
- 'off' - default, 'on', 'locked'
- Description:
- Should the fullscreen be on by default? off by default? or locked so that the user cannot un-fullscreen the map?
- Example:
- 'locked'