You are here

function _gmap_prepare in GMap Module 7.2

Same name and namespace in other branches
  1. 5 gmap.module \_gmap_prepare()
  2. 6.2 gmap.module \_gmap_prepare()
  3. 6 gmap.module \_gmap_prepare()
  4. 7 gmap.module \_gmap_prepare()

Handle filter preparation.

@todo move this to GmapFilterToolbox

1 call to _gmap_prepare()
_gmap_filter_process in ./gmap.module
Filter process callback for gmap_macro.

File

./gmap.module, line 360
GMap -- Routines to use the Google Maps API in Drupal.

Code

function _gmap_prepare($intext) {
  $out = FALSE;
  $matches = array();
  preg_match_all('/\\[gmap([^\\[\\]]+ )* \\] /x', $intext, $matches);
  $i = 0;
  while (isset($matches[1][$i])) {
    $out[0][$i] = $matches[0][$i];
    if ($matches[1][$i][0] == '1') {
      $ver = 1;
      $matches[1][$i] = substr($matches[0][$i], 1);
    }
    else {
      $ver = 2;
    }
    $map = array(
      '#type' => 'gmap',
      '#gmap_settings' => gmap_parse_macro($matches[1][$i], $ver),
    );
    $out[1][$i] = drupal_render($map);
    $i++;
  }

  // Endwhile process macro.
  return $out;
}