You are here

protected static function SupportTicketViewBuilder::buildLinks in Support Ticketing System 8

Build the default links (Read more) for a support ticket.

Parameters

\Drupal\support_ticket\SupportTicketInterface $entity: The support ticket object.

string $view_mode: A view mode identifier.

Return value

array An array that can be processed by drupal_pre_render_links().

1 call to SupportTicketViewBuilder::buildLinks()
SupportTicketViewBuilder::renderLinks in modules/support_ticket/src/SupportTicketViewBuilder.php
#lazy_builder callback; builds a support ticket's links.

File

modules/support_ticket/src/SupportTicketViewBuilder.php, line 104
Contains \Drupal\support_ticket\SupportTicketViewBuilder.

Class

SupportTicketViewBuilder
Render controller for support tickets.

Namespace

Drupal\support_ticket

Code

protected static function buildLinks(SupportTicketInterface $entity, $view_mode) {
  $links = array();

  // Always display a read more link on teasers because we have no way
  // to know when a teaser view is different than a full view.
  if ($view_mode == 'teaser') {
    $support_ticket_title_stripped = strip_tags($entity
      ->label());
    $links['support_ticket-readmore'] = array(
      'title' => t('Read more<span class="visually-hidden"> about @title</span>', array(
        '@title' => $support_ticket_title_stripped,
      )),
      'url' => $entity
        ->urlInfo(),
      'language' => $entity
        ->language(),
      'attributes' => array(
        'rel' => 'tag',
        'title' => $support_ticket_title_stripped,
      ),
    );
  }
  return array(
    '#theme' => 'links__support_ticket__support_ticket',
    '#links' => $links,
    '#attributes' => array(
      'class' => array(
        'links',
        'inline',
      ),
    ),
  );
}