You are here

class openlayers_layer_type_yahoo in Openlayers 6.2

OpenLayers Yahoo Layer Type class

Hierarchy

Expanded class hierarchy of openlayers_layer_type_yahoo

4 string references to 'openlayers_layer_type_yahoo'
openlayers_layer_type_yahoo::options_form in includes/layer_types/yahoo.inc
Options form which generates layers
_openlayers_openlayers_layers in includes/openlayers.layers.inc
@file
_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/yahoo.inc, line 11
Yahoo Layer Type

View source
class openlayers_layer_type_yahoo 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(
      'projection' => array(
        '900913',
      ),
      'layer_type' => 'yahoo',
      'layer_handler' => 'yahoo',
    );
  }

  /**
   * Options form which generates layers
   */
  function options_form() {
    $warning = !variable_get('openlayers_layers_yahoo_api', FALSE) ? array(
      '#value' => t('WARNING: Your Yahoo API key is not set.
          Map including Yahoo layers
          will break until it is set correctly.'),
    ) : NULL;
    $yahoo_layer_types = array(
      'hybrid' => 'Hybrid',
      'street' => 'Street',
      'satellite' => 'Satellite',
    );
    return array(
      'type' => array(
        '#title' => t('Yahoo Layer Type'),
        '#type' => 'select',
        '#default_value' => isset($this->data['type']) ? $this->data['type'] : 'normal',
        '#options' => $yahoo_layer_types,
      ),
      'layer_type' => array(
        '#type' => 'hidden',
        '#value' => 'openlayers_layer_type_yahoo',
      ),
      $warning,
    );
  }
  function settings_form() {
    return array(
      'openlayers_layers_yahoo_api' => array(
        '#type' => 'textfield',
        '#title' => t('Yahoo API Key'),
        '#default_value' => variable_get('openlayers_layers_yahoo_api', ''),
      ),
    );
  }

  /**
   * Render.
   */
  function render(&$map) {
    static $yahoo_maps_included;
    if (!isset($yahoo_maps_included)) {
      drupal_add_js(drupal_get_path('module', 'openlayers') . '/includes/layer_types/js/yahoo.js');
      drupal_set_html_head('<script src="' . check_url("http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=" . variable_get('openlayers_layers_yahoo_api', '')) . '" type="text/javascript"></script>');
      $yahoo_maps_included = TRUE;
    }
    return $this->options;
  }

}

Members