You are here

public function LeafletAttachment::render in Leaflet 8

Same name and namespace in other branches
  1. 2.1.x modules/leaflet_views/src/Plugin/views/display/LeafletAttachment.php \Drupal\leaflet_views\Plugin\views\display\LeafletAttachment::render()
  2. 2.0.x modules/leaflet_views/src/Plugin/views/display/LeafletAttachment.php \Drupal\leaflet_views\Plugin\views\display\LeafletAttachment::render()

Renders this display.

Overrides DisplayPluginBase::render

File

modules/leaflet_views/src/Plugin/views/display/LeafletAttachment.php, line 86

Class

LeafletAttachment
Plugin attachment of additional leaflet features to leaflet map views.

Namespace

Drupal\leaflet_views\Plugin\views\display

Code

public function render() {
  $rows = !empty($this->view->result) || $this->view->style_plugin
    ->evenEmpty() ? $this->view->style_plugin
    ->render($this->view->result) : [];

  // The element is rendered during preview only; when used as an attachment
  // in the Leaflet class, only the 'rows' property is used.
  $element = [
    '#markup' => print_r($rows, TRUE),
    '#prefix' => '<pre>',
    '#suffix' => '</pre>',
    '#attached' => &$this->view->element['#attached'],
    'rows' => $rows,
  ];
  return $element;
}