You are here

public function Layer::render in Geolocation Field 8.3

Render the display in this style.

Overrides GeolocationStyleBase::render

File

src/Plugin/views/style/Layer.php, line 23

Class

Layer
Allow to display several field items on a common map.

Namespace

Drupal\geolocation\Plugin\views\style

Code

public function render() {
  $render = parent::render();
  if ($render === FALSE) {
    return [];
  }
  $build = [
    '#type' => 'container',
    '#attributes' => [
      'id' => $this->displayHandler->display['id'],
      'class' => [
        'geolocation-layer',
      ],
    ],
  ];

  /*
   * Add locations to output.
   */
  foreach ($this->view->result as $row) {
    foreach ($this
      ->getLocationsFromRow($row) as $location) {
      $build['locations'][] = $location;
    }
  }
  return $build;
}