You are here

public function EntityPrintViewsLink::render in Entity Print 8.2

Render the area.

Parameters

bool $empty: (optional) Indicator if view result is empty or not. Defaults to FALSE.

Return value

array In any case we need a valid Drupal render array to return.

Overrides AreaPluginBase::render

File

modules/entity_print_views/src/Plugin/views/area/EntityPrintViewsLink.php, line 92

Class

EntityPrintViewsLink
Views area handler for a Print button.

Namespace

Drupal\entity_print_views\Plugin\views\area

Code

public function render($empty = FALSE) {
  $route_params = [
    'export_type' => !empty($this->options['export_type']) ? $this->options['export_type'] : 'pdf',
    'view_name' => $this->view->storage
      ->id(),
    'display_id' => $this->options['display_id'],
  ];
  return [
    '#type' => 'link',
    '#title' => $this->options['link_text'],
    '#url' => Url::fromRoute('entity_print_views.view', $route_params, [
      'query' => $this->view
        ->getExposedInput() + [
        'view_args' => $this->view->args,
      ],
    ]),
  ];
}