public function GeolocationMapPolygon::preRenderPolygon in Geolocation Field 8.3
Polygon element.
Parameters
array $render_array: Element.
Return value
array Renderable map.
File
- src/
Element/ GeolocationMapPolygon.php, line 60
Class
- GeolocationMapPolygon
- Provides a render element for a single geolocation map location.
Namespace
Drupal\geolocation\ElementCode
public function preRenderPolygon(array $render_array) {
$render_array = parent::preRenderGeolocationShape($render_array);
$render_array['#theme'] = 'geolocation_map_polygon';
$render_array['#attributes']
->addClass('geolocation-polygon');
if (!empty($render_array['#fill_color'])) {
$render_array['#attributes']
->setAttribute('data-fill-color', $render_array['#fill_color']);
}
if (!empty($render_array['#fill_opacity'])) {
$render_array['#attributes']
->setAttribute('data-fill-opacity', (double) $render_array['#fill_opacity']);
}
return $render_array;
}