public function LeafletMarker::render in Leaflet 2.0.x
Same name and namespace in other branches
- 8 modules/leaflet_views/src/Plugin/views/row/LeafletMarker.php \Drupal\leaflet_views\Plugin\views\row\LeafletMarker::render()
- 2.1.x modules/leaflet_views/src/Plugin/views/row/LeafletMarker.php \Drupal\leaflet_views\Plugin\views\row\LeafletMarker::render()
Render a row object. This usually passes through to a theme template of some form, but not always.
Parameters
object $row: A single row of the query result, so an element of $view->result.
Return value
string The rendered output of a single row, used by the style plugin.
Overrides RowPluginBase::render
File
- modules/
leaflet_views/ src/ Plugin/ views/ row/ LeafletMarker.php, line 302
Class
- LeafletMarker
- Plugin which formats a row as a leaflet marker.
Namespace
Drupal\leaflet_views\Plugin\views\rowCode
public function render($row) {
/* @var \Drupal\views\ResultRow $row */
$geofield_value = $this->view
->getStyle()
->getFieldValue($row->index, $this->options['data_source']);
if (empty($geofield_value)) {
return FALSE;
}
// @TODO This assumes that the user has selected WKT as the geofield output
// formatter in the views field settings, and fails otherwise. Very brittle.
$result = $this->leafletService
->leafletProcessGeofield($geofield_value);
// Convert the list of geo data points into a list of leaflet markers.
return $this
->renderLeafletMarkers($result, $row);
}