protected function SupportTicket::renderLink in Support Ticketing System 8
Prepares link to the support ticket.
Parameters
string $data: The XSS safe string for the link text.
\Drupal\views\ResultRow $values: The values retrieved from a single row of a view's query result.
Return value
string Returns a string for the link text.
1 call to SupportTicket::renderLink()
- SupportTicket::render in modules/
support_ticket/ src/ Plugin/ views/ field/ SupportTicket.php - Renders the field.
File
- modules/
support_ticket/ src/ Plugin/ views/ field/ SupportTicket.php, line 74 - Contains \Drupal\support_ticket\Plugin\views\field\SupportTicket.
Class
- SupportTicket
- Field handler to provide simple renderer that allows linking to a support ticket. Definition terms:
Namespace
Drupal\support_ticket\Plugin\views\fieldCode
protected function renderLink($data, ResultRow $values) {
if (!empty($this->options['link_to_support_ticket']) && !empty($this->additional_fields['stid'])) {
if ($data !== NULL && $data !== '') {
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['url'] = Url::fromRoute('entity.support_ticket.canonical', [
'support_ticket' => $this
->getValue($values, 'stid'),
]);
if (isset($this->aliases['langcode'])) {
$languages = \Drupal::languageManager()
->getLanguages();
$langcode = $this
->getValue($values, 'langcode');
if (isset($languages[$langcode])) {
$this->options['alter']['language'] = $languages[$langcode];
}
else {
unset($this->options['alter']['language']);
}
}
}
else {
$this->options['alter']['make_link'] = FALSE;
}
}
return $data;
}