You are here

protected function WebformExceptionHtmlSubscriber::setMessage in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/EventSubscriber/WebformExceptionHtmlSubscriber.php \Drupal\webform\EventSubscriber\WebformExceptionHtmlSubscriber::setMessage()

Display custom message.

Parameters

null|string $message: (Optional) Message to be display on user login.

null|\Drupal\Core\Entity\EntityInterface $entity: (Optional) Entity to be used when replacing tokens.

2 calls to WebformExceptionHtmlSubscriber::setMessage()
WebformExceptionHtmlSubscriber::on403RedirectEntityAccess in src/EventSubscriber/WebformExceptionHtmlSubscriber.php
Redirect to user login when access is denied for webform or submission.
WebformExceptionHtmlSubscriber::redirectToLogin in src/EventSubscriber/WebformExceptionHtmlSubscriber.php
Redirect to user login with destination and display custom message.

File

src/EventSubscriber/WebformExceptionHtmlSubscriber.php, line 319

Class

WebformExceptionHtmlSubscriber
Event subscriber to redirect to login form when webform settings instruct to.

Namespace

Drupal\webform\EventSubscriber

Code

protected function setMessage($message, EntityInterface $entity = NULL) {
  $message = $this->tokenManager
    ->replace($message, $entity);
  $build = WebformHtmlEditor::checkMarkup($message);
  $this->messenger
    ->addStatus($this->renderer
    ->renderPlain($build));
}