Views template for field is ignored
emackn - September 9, 2009 - 19:31
| Project: | OpenLayers |
| Version: | 6.x-1.x-dev |
| Component: | OpenLayers Views |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | fixed |
Jump to:
Description
I've been looking around in all the docs and in the message queue and can't seem to find how to theme a field in my popup.
I have my map with markers on it, simple. My marker popups use the title field, but I have some special theming needed for the title field, but the view template for the that field is ignored. I thought I might have needed to implement theme_openlayers_views_feature_style() but that didn't change anything rendered on the map.
What am I missing?
Regards,
Eric

#1
"view template for the that field is ignored" - this sounds like a bug.
#2
#3
I did notice that it does find the openlayers-views* templates, but none of the others as far as I can tell.
#4
At the end of render(), (openlayers_views_style_map.inc:456), $this->theme_functions() is only returning
<?phpArray
(
[0] => openlayers_views_map__hotspots__block_1
[1] => openlayers_views_map__block_1
[2] => openlayers_views_map__
[3] => openlayers_views_map__hotspots__block
[4] => openlayers_views_map__block
[5] => openlayers_views_map__hotspots
[6] => openlayers_views_map
)
?>
#5
Can anyone else confirm that the OL Views plugin is not using the field theme functions?
#6
Here's the thing. OpenLayers module provides a style plugin which does provide the usual theme functions, as listed above.
But, for fields, these are handled by field handlers. For instance, outputting the theme functions for a field:
array(12) {[0]=>
string(80) "views_view_field__openlayers_theme_test__page_1__field_test_field_openlayers_wkt"
[1]=>
string(47) "views_view_field__openlayers_theme_test__page_1"
[2]=>
string(57) "views_view_field__page_1__field_test_field_openlayers_wkt"
[3]=>
string(24) "views_view_field__page_1"
[4]=>
string(78) "views_view_field__openlayers_theme_test__page__field_test_field_openlayers_wkt"
[5]=>
string(45) "views_view_field__openlayers_theme_test__page"
[6]=>
string(55) "views_view_field__page__field_test_field_openlayers_wkt"
[7]=>
string(22) "views_view_field__page"
[8]=>
string(72) "views_view_field__openlayers_theme_test__field_test_field_openlayers_wkt"
[9]=>
string(39) "views_view_field__openlayers_theme_test"
[10]=>
string(49) "views_view_field__field_test_field_openlayers_wkt"
[11]=>
string(16) "views_view_field"
}
So, you should be able to theme the field just like in a any other View.
For popups, the field or row gets rendered like any normal View part, but we stick some custom HTML around it. In theory this should be in a theme function, but it is HTML that makes the popups behave correctly.