array( 'title' => t('Google'), 'description' => t('Google Maps API Map'), 'layer_type' => array( 'path' => drupal_get_path('module', 'openlayers') .'/includes/layer_types', 'file' => 'google.inc', 'class' => 'openlayers_layer_type_google', 'parent' => 'openlayers_layer_type', ), ), ); } /** * CTools Registration Hook * * IMPORTANT: * * In order to support styles, presets, and layers in an external module, * one must notify the CTools module that that module provides implementations * of the hooks for styles, presets, and/or layers. * * This function is just an example implementation of * hook_ctools_plugin_api() and should be alter according to * your module's name. * * @param $module * Name of a module that supports CTools exportables. * @param $api * Name of the kind of exportable supported. * @return * If $module is 'openlayers', and $api is a type of exportable that * your module provides, and you are using Openlayers 2.x, then * return array with the following values: * - version => 1 */ function openlayers_example_ctools_plugin_api($module, $api) { if ($module == "openlayers") { switch ($api) { case 'openlayers_presets': return array('version' => 1); case 'openlayers_layers': return array('version' => 1); case 'openlayers_styles': return array('version' => 1); } } } /** * OpenLayers Layers * * This hook tells OpenLayers about the available layers * that can be used by name in maps. * * Ensure that you are telling CTools about this as well. * @see openlayers_example_ctools_plugin_api(). * * Please note, that to support translation for exportable * code for potx extraction, you should include separate code * of translatable string. * * @return * Return an associative array with index being a unique string * identifier, and simple objects with the following properties: * - "api_version": * - "name": * - "title": * - "data": */ function hook_openlayers_layers() { // Taken from openlayers.layers.inc $layers = array(); $layer = new stdClass(); $layer->api_version = 1; $layer->name = 'google_satellite'; $layer->title = 'Google Maps Satellite'; $layer->description = 'Google Maps Satellite Imagery.'; $layer->data = array( 'baselayer' => TRUE, 'type' => 'satellite', 'projection' => array('900913'), 'layer_type' => 'openlayers_layer_type_google', ); $layers[$layer->name] = $layer; return $layers; // Extra code to support potx extractors $potx = array( t('Google Maps Satellite'), t('Google Maps Satellite Imagery.'), ); } /** * OpenLayers Behaviors * * This hook tells OpenLayers about the available behaviors * that can be used in maps. * * Ensure that you are telling CTools about this as well. * @see openlayers_example_ctools_plugin_api(). * * @return * Return a nested associative array with the top level * being a unique string identifier, and the nested array * containing the following key/pairs: * - "title": * - "description": * - "file": * - "type": * - "behavior": */ function hook_openlayers_behaviors() { // Taken from openlayers.behaviors.inc return array( 'openlayers_behavior_attribution' => array( 'title' => t('Attribution'), 'description' => t('Allows layers to provide attribution to the map if it exists.'), 'type' => 'layer', 'path' => drupal_get_path('module', 'openlayers') .'/includes/behaviors', 'file' => 'openlayers_behavior_attribution.inc', 'behavior' => array( 'class' => 'openlayers_behavior_attribution', 'parent' => 'openlayers_behavior', ), ), ); } /** * 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. * @see openlayers_example_ctools_plugin_api(). * * @return * Return an associative array with index being a unique string * identifier, and simple objects with the following properties: * - "api_version": * - "name": * - "title": * - "data": */ 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; } /** * OpenLayers Presets * * Define map presets. * * @return * Return an associative array with index being a unique string * identifier, and simple objects with the following properties: * - "api_version": * - "name": * - "title": * - "data": */ function hook_openlayers_presets() { // Taken from openlayers.presets.inc $default = new stdClass(); $default->api_version = 1; $default->name = 'default'; $default->title = t('Default Map'); $default->description = t('This is the default map preset that comes with the OpenLayers module.'); $default->data = array( 'projection' => '900913', 'width' => 'auto', 'default_layer' => 'osm_mapnik', 'height' => '400px', 'center' => array( 'initial' => array( 'centerpoint' => '0,0', 'zoom' => '2' ) ), 'options' => array( 'displayProjection' => '4326', 'maxExtent' => openlayers_get_extent('4326'), ), 'behaviors' => array( 'openlayers_behavior_panzoombar' => array(), 'openlayers_behavior_layerswitcher' => array(), 'openlayers_behavior_attribution' => array(), 'openlayers_behavior_keyboarddefaults' => array(), 'openlayers_behavior_navigation' => array(), ), 'layers' => array( 'osm_mapnik' => 'osm_mapnik', ) ); return array('default' => $default); } /** * CTools Registration Hook (Style Plugins) * * IMPORTANT: * * In order to support style plugins, the first step is to * tell CTools where to find the plugin. * * This function is just an example implementation of * hook_ctools_plugin_directory() and should be alter according to * your module's name. * * For an example, please see the openlayers_test.module * * @param $module * Name of a module that supports CTools exportables. * @param $plugin * Name of the kind of plugin supported. * @return * If $module is 'openlayers', and $api is a type of exportable that * your module provides, and you are using Openlayers 2.x, then * return the directory relative to a module to look for this * particular plugin. */ function openlayers_ctools_plugin_directory($module, $plugin) { if ($module == 'openlayers' && $plugin == 'style_plugin') { return 'plugins/style_plugin'; } }