Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#2 | preset_name_in_map_data.patch | 848 bytes | strk |
Comments
Comment #1
zzolo CreditAttribution: zzolo commented+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).
Comment #2
strk CreditAttribution: strk commentedThe 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).
Comment #3
strk CreditAttribution: strk commentedOr 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).
Comment #4
strk CreditAttribution: strk commentedUhm, tried the approach in previous comment, but it will have troubles serializing the recursion:
Well, 'preset_name' is good enough for now...
Comment #5
strk CreditAttribution: strk commentedComment #6
strk CreditAttribution: strk commentedCommitted http://drupal.org/cvs?commit=395868
Comment #7
strk CreditAttribution: strk commentedExcellent start with CVS... correct commit is here: http://drupal.org/cvs?commit=395870