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

phayes - September 9, 2009 - 19:33
Category:support request» bug report

"view template for the that field is ignored" - this sounds like a bug.

#2

phayes - September 9, 2009 - 19:34
Title:How do I theme my view fields?» Views template for field is ignored

#3

emackn - September 9, 2009 - 20:14
Category:bug report» support request

I did notice that it does find the openlayers-views* templates, but none of the others as far as I can tell.

#4

emackn - September 9, 2009 - 21:40

At the end of render(), (openlayers_views_style_map.inc:456), $this->theme_functions() is only returning

<?php
Array
(
    [
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

zzolo - October 27, 2009 - 15:56
Version:6.x-1.0-beta1» 6.x-1.x-dev

Can anyone else confirm that the OL Views plugin is not using the field theme functions?

#6

zzolo - December 31, 2009 - 00:48
Status:active» fixed

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.

 
 

Drupal is a registered trademark of Dries Buytaert.