You are here

public function GmapMacroToolbox::getParsedStyles in GMap Module 7.2

Getting a parsed styles.

Return value

array former _gmap_parse_style($style)

File

lib/Drupal/gmap/GmapMacroToolbox.php, line 86
Contains GmapMacroToolbox.php

Class

GmapMacroToolbox

Namespace

Drupal\gmap

Code

public function getParsedStyles() {
  if (strpos($this->style, '/') === FALSE) {

    // Style ref.
    return $this->style;
  }
  $styles = explode('/', $this->style);

  // @@@ Todo: Fix up old xmaps stuff.
  // Possibly detect by looking for array length 7?
  // Strip off # signs, they get added by code.
  if (isset($styles[0]) && substr($styles[0], 0, 1) == '#') {
    $styles[0] = substr($styles[0], 1);
  }
  if (isset($styles[3]) && substr($styles[3], 0, 1) == '#') {
    $styles[3] = substr($styles[3], 1);
  }

  // Assume anything > 0 and < 1.1 was an old representation.
  if ($styles[2] > 0 && $styles[2] < 1.1) {
    $styles[2] = $styles[2] * 100;
  }
  if (isset($styles[4])) {
    if ($styles[4] > 0 && $styles[4] < 1.1) {
      $styles[4] = $styles[4] * 100;
    }
  }
  return $styles;
}