You are here

function openlayers_views_style_data::render in Openlayers 7.2

Same name and namespace in other branches
  1. 6.2 modules/openlayers_views/views/openlayers_views_style_data.inc \openlayers_views_style_data::render()

Render the map features.

Overrides views_plugin_style->render

Overrides views_plugin_style::render

File

modules/openlayers_views/views/openlayers_views_style_data.inc, line 24
This file holds style plugin for OpenLayers Views

Class

openlayers_views_style_data
@class Extension of the Views Plugin Style for OpenLayers

Code

function render() {
  $grouped_results = $this
    ->render_grouping($this->view->result, $this->options['grouping']);
  $data = $this
    ->map_features($grouped_results);

  // If we are not in preview, just return the data
  if (empty($this->view->live_preview)) {
    return $data;
  }
  else {

    // If we are in preview mode, dump out some useful information about this data layer
    $output = "You can use the following parameters in your styles as dynamic values";
    $output .= "\n------------\n";
    if (!empty($data)) {
      $keys = array_keys($data);
      foreach ($data[$keys[0]]['attributes'] as $key => $value) {
        $output .= '${' . $key . "}\n";
      }
    }
    $output .= "\n------------\n";
    $output .= t('The following is a dump of the data that is rendered from this display. It is used for debugging purposes only.') . '
        ' . var_export($data, TRUE);
    return $output;
  }
}