You are here

public function ListingEmpty::render in Support Ticketing System 8

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/support_ticket/src/Plugin/views/area/ListingEmpty.php, line 64
Contains \Drupal\support_ticket\Plugin\views\area\ListingEmpty.

Class

ListingEmpty
Defines an area plugin to display a support_ticket/add link.

Namespace

Drupal\support_ticket\Plugin\views\area

Code

public function render($empty = FALSE) {
  $account = \Drupal::currentUser();
  if (!$empty || !empty($this->options['empty'])) {
    $element = array(
      '#theme' => 'links',
      '#links' => array(
        array(
          'url' => Url::fromRoute('support_ticket.add_page'),
          'title' => $this
            ->t('Add ticket'),
        ),
      ),
      '#access' => $this->accessManager
        ->checkNamedRoute('support_ticket.add_page', array(), $account),
    );
    return $element;
  }
  return array();
}