You are here

protected function KernelTerminateSubscriber::_getTitle in Visitors 8.2

Get the title of the current page.

Return value

string Title of the current page.

1 call to KernelTerminateSubscriber::_getTitle()
KernelTerminateSubscriber::onTerminate in src/EventSubscriber/KernelTerminateSubscriber.php
Store visitors data when a request terminates.

File

src/EventSubscriber/KernelTerminateSubscriber.php, line 107
Contains Drupal\visitors\EventSubscriber\KernelTerminateSubscriber.

Class

KernelTerminateSubscriber
Store visitors data when a request terminates.

Namespace

Drupal\visitors\EventSubscriber

Code

protected function _getTitle() {
  $title = '';
  $routeObject = \Drupal::routeMatch()
    ->getRouteObject();
  if (!is_null($routeObject)) {
    $title = \Drupal::routeMatch()
      ->getRouteObject()
      ->getDefault("_title");
  }
  return htmlspecialchars_decode($title, ENT_QUOTES);
}