Download & Extend

Optional use of text or tabs in infoWindow

Project:GMap Module
Version:5.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I needed themable tabs based on node content in my gmap infoWindow. Brandon clued me in on how to get there, and now I am extending a nice patch/recommendation/request to review based on that work. My implementation lets the theme developer optionally and seamlessly use either tabs or text (no tabs) in the infoWindow. I wrote it such that it wouldn't break existing implementations.

How to use:
- apply the patches (one to gmap_marker.js, one to gmap_view.module) from drupal root
- out the box, this should show your tabs exactly as they are whether or not you've themed your marker view...
- optionally, provide a function "phptemplate_gmap_views_marker_label" in template.php to theme the gmap_view marker. This theme should return
-- an html or text string for tab-less infoWindow
-- an array of html or text strings representing tabs in the infoWindow

Simple template.php snippet:

function phptemplate_gmap_views_marker_label($view,$fields,$entry) {
  $marker_label = '';
  $marker_directions = '';
  drupal_add_css(path_to_theme() .'/histmarkers_map.css');
  $marker_label = '<div class="gmap-infowin">'
        .'... <b>some html for tab1 called Marker</b>'
        .'</div>'
  ;
 
  $marker_directionstxt = '... <b>some html for tab2 called Directions</b>...';

  $marker_directions = '<div class="gmap-infowin">'
        .'<h1 class="title">Special instructions for this historical marker</h1>'
        .'<div class="marker-text">'. $marker_directionstxt
        .'</div>'
        .'</div>'
  ;
 
  $marker_tabs = array(
    'Marker' => $marker_label,
    'Directions' => $marker_directions,
  );
  return $marker_tabs;
}

I trimmed out the meat that contains the node-references, but that's all basic theming there..

AttachmentSize
gmap_views.module.patch1.26 KB

Comments

#1

(the required other 1/2 of the two-file patch)

AttachmentSize
gmap_marker.js_.patch 649 bytes

#2

Committed to DRUPAL-5.

#3

Status:needs review» fixed

#4

Status:fixed» needs work

Shoot!

There was PHP5 specific code there.

Reopening issue.

#5

Status:needs work» fixed

Committed fix.

#6

Status:fixed» closed (fixed)