When implementing map alters it's useful to have access to the map preset name.
This could be done by adding the preset name to the $map array passed around
or passing the map preset name to the hooks.

I'm fine with both, and ready to make a patch.
Comments welcome on pro/cons of each approach.

Files: 
CommentFileSizeAuthor
#2 preset_name_in_map_data.patch848 bytesstrk
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch preset_name_in_map_data.patch.
[ View ]

Comments

+1 on this. It will definitely be useful on the map alters. I would suggest putting the preset name into the map array so that it could be used in other places if necessary, as well as updating the passing of argument seems unnecessary and could possibly break the use of the hooks (but probably not).

StatusFileSize
new848 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch preset_name_in_map_data.patch.
[ View ]

The attached patch adds 'preset_name' attribute to the preset data (the one being passed around to hooks and also containing the 'id').

Note that (for future improvements/cleanups) openlayers_render_map, which currently takes an optional preset_name, might get it from first argument if not explicitly overridden by caller (didn't touch that code in this patch).

Or maybe, another approach, is that IFF a preset is available, $preset->data['preset'] = $preset
That way we'd have all preset informations available, and probably with no data copies ($preset being a stdClass).

Uhm, tried the approach in previous comment, but it will have troubles serializing the recursion:

warning: json_encode(): recursion detected in modules/openlayers/openlayers.module on line 179.warning: json_encode(): recursion detected in modules/openlayers/openlayers.module on line 179.

Well, 'preset_name' is good enough for now...

Status:Active» Needs review

Status:Needs review» Fixed

Excellent start with CVS... correct commit is here: http://drupal.org/cvs?commit=395870

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.