MatomoTestController.php 854 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace Drupal\matomo_test\Controller;
  3. use Drupal\Core\Controller\ControllerBase;
  4. /**
  5. * Controller routines for system_test routes.
  6. */
  7. class MatomoTestController extends ControllerBase {
  8. /**
  9. * Tests setting messages and removing one before it is displayed.
  10. *
  11. * @return array
  12. * Empty array, we just test the setting of messages.
  13. */
  14. public function drupalAddMessageTest() {
  15. // Set some messages.
  16. $this->messenger()->addMessage($this->t('Example status message.'), 'status');
  17. $this->messenger()->addMessage($this->t('Example warning message.'), 'warning');
  18. $this->messenger()->addMessage($this->t('Example error message.'), 'error');
  19. $this->messenger()->addMessage($this->t('Example error <em>message</em> with html tags and <a href="https://example.com/">link</a>.'), 'error');
  20. return [];
  21. }
  22. }