I see that drupal_alter('openlayers_map_preprocess', $map); has been removed. Is there a reason for this? I personally have found it invaluable to be able to do a hook_alter both before and after a map has gone through the rendering process.
I see that drupal_alter('openlayers_map_preprocess', $map); has been removed. Is there a reason for this? I personally have found it invaluable to be able to do a hook_alter both before and after a map has gone through the rendering process.
Comments
Comment #1
tmcw commentedWhat's the main use case of this? I'm not terribly opposed to adding in a hook if there's a blind spot for the new technique (although I'll admit a hatred of 'process' functions so I'd rather call it openlayers_map_prerender, etc).
- note, my hatred of process functions is that, they all do different things apparently, and 'process' is a synonym for 'do something and get something' which is what every function ever does, so they boil down to, like, PHP GOTOs or something, and make the code so much less understandable to new coders. So, render makes a bit more sense (because it calls render() ), or attach if it attaches things, but process...
Comment #2
phayes commentedRight. Let's rename them and call them
hook_openlayers_alter, andhook_openlayers_postrender_alterReasons are thus:
Definitely need the pre-render
hook_openlayers_alterso that other modules can jump in and add layers, behaviors, styles etc. that are not defined by the preset. (Or remove behaviors etc. that are defined)The
hook_openlayers_postrender_alteralso very useful. It's basically a 'last call' for changes before the map array gets outputted to JS. Layers, behaviors etc. are passed $map by reference and are allowed to make changes to it, so this is useful to change the map after those are finished. It is also useful if we end up going with 1.x style registration of events in the map array (http://drupal.org/node/591252) as it would allow altering of any events registered by behaviors etc. Finally this could alter the data stored inside a layer, behavior etc. just before show-time (not possible in a pre-render hook since this data would not exposed yet). This hook would not be able to add new layers, behaviors, or styles - it would be for final tweaks to existing data.zzolo and I had a long discussion about this. I'm trying to find the old issue on it, but I can't.
Comment #3
phayes commentedCommitted as suggested above: http://drupal.org/cvs?commit=331112