class openlayers_layer_type_cloudmade in Openlayers 6.2
Same name and namespace in other branches
- 7.2 plugins/layer_types/openlayers_layer_type_cloudmade.inc \openlayers_layer_type_cloudmade
OpenLayers CloudMade Layer Type class
Hierarchy
- class \openlayers_layer_type
Expanded class hierarchy of openlayers_layer_type_cloudmade
3 string references to 'openlayers_layer_type_cloudmade'
- openlayers_layer_type_cloudmade::options_form in includes/
layer_types/ cloudmade.inc - Options form which generates layers
- _openlayers_openlayers_layer_types in includes/
openlayers.layer_types.inc - Layer Type Implementation
- _openlayers_upgrade_1xto2x_convert_layers in ./
openlayers.install - Converting layer arrays for the upgrade from 1.x to 2.x
File
- includes/
layer_types/ cloudmade.inc, line 12 - OpenLayers CloudMade layer type
View source
class openlayers_layer_type_cloudmade extends openlayers_layer_type {
function __construct($layer = array(), $map = array()) {
parent::__construct($layer, $map);
if (isset($this->data)) {
$this->data += $this
->options_init();
}
else {
$this->data = $this
->options_init();
}
}
/**
* Provide initial values for options.
*/
function options_init() {
return array(
'layer_type' => 'cloudmade',
'layer_handler' => 'cloudmade',
'key' => variable_get('openlayers_layers_cloudmade_api', ''),
'projection' => array(
'900913',
),
'baselayer' => TRUE,
);
}
/**
* Options form which generates layers
*/
function options_form() {
$warning = !variable_get('openlayers_layers_cloudmade_js', FALSE) || !variable_get('openlayers_layers_cloudmade_api', FALSE) ? array(
'#value' => t('WARNING: Your CloudMade API key or
Javascript location is not set. Map including CloudMade layers
will break until they are set correctly.'),
) : NULL;
return array(
'styleId' => array(
'#type' => 'textfield',
'#title' => t('Style ID'),
'#description' => t('Enter the numeric Style ID for a <a href="http://maps.cloudmade.com/editor">Map Style</a> from CloudMade. You can usually find the Style ID in the lower right hand corner of each Map Style box.'),
'#default_value' => isset($this->data['styleId']) ? $this->data['styleId'] : '',
),
'layer_type' => array(
'#type' => 'hidden',
'#value' => 'openlayers_layer_type_cloudmade',
),
$warning,
);
}
/**
* Layer-type-wide settings form
*/
function settings_form() {
return array(
'openlayers_layers_cloudmade_api' => array(
'#type' => 'textfield',
'#title' => t('CloudMade API Key'),
'#default_value' => variable_get('openlayers_layers_cloudmade_api', ''),
'#description' => t('<a href="@cloudmade">Get a CloudMade account and API Key</a>', array(
'@cloudmade' => 'http://cloudmade.com/user/show',
)),
),
'openlayers_layers_cloudmade_js' => array(
'#type' => 'textfield',
'#title' => t('CloudMade Javascript Location'),
'#default_value' => variable_get('openlayers_layers_cloudmade_js', ''),
'#description' => t('The Drupal path or full URL to the location of the ' . '<a href="@url">Cloudmade OpenLayers Javascript library</a>', array(
'@url' => 'http://developers.cloudmade.com/projects/show/openlayers-api',
)),
),
);
}
/**
* Render.
*/
function render(&$map) {
static $cloudmade_maps_included;
if (!isset($cloudmade_maps_included)) {
drupal_add_js(drupal_get_path('module', 'openlayers') . '/includes/layer_types/js/cloudmade.js');
$path = variable_get('openlayers_layers_cloudmade_js', '');
if (valid_url($path, TRUE)) {
drupal_set_html_head('<script src="' . check_url($path) . '" type="text/javascript"></script>');
}
else {
drupal_add_js($path);
}
$cloudmade_maps_included = TRUE;
}
return $this->options;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
openlayers_layer_type:: |
property | |||
openlayers_layer_type:: |
function | |||
openlayers_layer_type:: |
function | |||
openlayers_layer_type_cloudmade:: |
function |
Options form which generates layers Overrides openlayers_layer_type:: |
||
openlayers_layer_type_cloudmade:: |
function |
Provide initial values for options. Overrides openlayers_layer_type:: |
||
openlayers_layer_type_cloudmade:: |
function |
Render. Overrides openlayers_layer_type:: |
||
openlayers_layer_type_cloudmade:: |
function | Layer-type-wide settings form | ||
openlayers_layer_type_cloudmade:: |
function |
Overrides openlayers_layer_type:: |