You are here

function gmap_filter in GMap Module 6.2

Same name and namespace in other branches
  1. 5 gmap.module \gmap_filter()
  2. 6 gmap.module \gmap_filter()

Implementation of hook_filter().

File

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

Code

function gmap_filter($op, $delta = 0, $format = -1, $text = '') {
  switch ($op) {
    case 'list':
      return array(
        0 => t('GMap macro expander'),
      );
    case 'name':
      return t('Google map filter');
    case 'description':
      return t('Converts a Google Map macro into the HTML required for inserting a Google Map.');
    case 'process':
      $gmaps = _gmap_prepare($text);

      //returns an array of $tables[0] = table macro $table[1]= table html
      if ($gmaps) {

        // there are table macros in this node
        return str_replace($gmaps[0], $gmaps[1], $text);
      }
      else {
        return $text;
      }
    case 'prepare':
      return $text;
    case 'no cache':
      return TRUE;
  }
}