You are here

function _openlayers_upgrade_1xto2x_convert_general in Openlayers 6.2

Converting general map propoerties for the upgrade from 1.x to 2.x

Parameters

$map: Reference to map array

$ret: Reference to return array

1 call to _openlayers_upgrade_1xto2x_convert_general()
_openlayers_upgrade_1xto2x in ./openlayers.install
Function to handle upgrading from 1.x to 2.x

File

./openlayers.install, line 307
This file holds the functions for the installing and enabling of the openlayers module.

Code

function _openlayers_upgrade_1xto2x_convert_general(&$map = array(), &$ret = array()) {

  // Change center
  if (isset($map['center']) && is_array($map['center'])) {
    $map['center'] = array(
      'initial' => array(
        'centerpoint' => $map['center']['lat'] . ',' . $map['center']['lon'],
        'zoom' => $map['center']['zoom'],
      ),
    );
  }

  // Options
  if (isset($map['options']) && is_array($map['options'])) {

    // maxExtent
    // Is this a requirement for 2.x?
    if (isset($map['options']['maxExtent']) && is_array($map['options']['maxExtent'])) {
      $map['options']['maxExtent'] = array(
        $map['options']['maxExtent']['left'],
        $map['options']['maxExtent']['bottom'],
        $map['options']['maxExtent']['right'],
        $map['options']['maxExtent']['top'],
      );
    }
  }
}