You are here

function hook_support_ticket_links_alter in Support Ticketing System 8

Alter the links of a support ticket.

Parameters

array &$links: A renderable array representing the support ticket links.

\Drupal\support_ticket\SupportTicketInterface $entity: The support ticket being rendered.

array &$context: Various aspects of the context in which the support ticket links are going to be displayed, with the following keys:

  • 'view_mode': the view mode in which the support ticket is being viewed
  • 'langcode': the language in which the support ticket is being viewed

See also

\Drupal\support_ticket\SupportTicketViewBuilder::renderLinks()

\Drupal\support_ticket\SupportTicketViewBuilder::buildLinks()

Entity CRUD, editing, and view hooks

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

File

modules/support_ticket/support_ticket.api.php, line 91
Hooks specific to the Support ticket module.

Code

function hook_support_ticket_links_alter(array &$links, SupportTicketInterface $entity, array &$context) {
  $links['mymodule'] = array(
    '#theme' => 'links__support_ticket__mymodule',
    '#attributes' => array(
      'class' => array(
        'links',
        'inline',
      ),
    ),
    '#links' => array(
      'support_ticket-report' => array(
        'title' => t('Report'),
        'href' => "support_ticket/{$entity->id()}/report",
        'query' => array(
          'token' => \Drupal::getContainer()
            ->get('csrf_token')
            ->get("support_ticket/{$entity->id()}/report"),
        ),
      ),
    ),
  );
}