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..

Comments

texas-bronius’s picture

StatusFileSize
new649 bytes

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

bdragon’s picture

Committed to DRUPAL-5.

bdragon’s picture

Status: Needs review » Fixed
bdragon’s picture

Status: Fixed » Needs work

Shoot!

There was PHP5 specific code there.

Reopening issue.

bdragon’s picture

Status: Needs work » Fixed

Committed fix.

Anonymous’s picture

Status: Fixed » Closed (fixed)