messenger = $messenger; } public function displayMessage(GetResponseEvent $event) { if (\Drupal::service('router.admin_context')->isAdminRoute()) { return; } $this->messenger->addMessage($this->t('This site is running on a Vagrant server, deployed with Ansible and Ansistrano.', [ '@ansible' => 'https://ansible.com', '@ansistrano' => 'https://ansistrano.com', '@vagrant' => 'https://vagrantup.com', ])); } /** * @inheritDoc */ public static function getSubscribedEvents() { $events[KernelEvents::REQUEST][] = ['displayMessage']; return $events; } }