SupportTicketViewController.php in Support Ticketing System 8
File
modules/support_ticket/src/Controller/SupportTicketViewController.php
View source
<?php
namespace Drupal\support_ticket\Controller;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\Controller\EntityViewController;
class SupportTicketViewController extends EntityViewController {
public function view(EntityInterface $support_ticket, $view_mode = 'full', $langcode = NULL) {
$build = parent::view($support_ticket);
foreach ($support_ticket
->uriRelationships() as $rel) {
$build['#attached']['html_head_link'][] = array(
array(
'rel' => $rel,
'href' => $support_ticket
->url($rel),
),
TRUE,
);
if ($rel == 'canonical') {
$build['#attached']['html_head_link'][] = array(
array(
'rel' => 'shortlink',
'href' => $support_ticket
->url($rel, array(
'alias' => TRUE,
)),
),
TRUE,
);
}
}
return $build;
}
public function title(EntityInterface $support_ticket) {
return $this->entityManager
->getTranslationFromContext($support_ticket)
->label();
}
}