You are here

protected function WebformDefaultExceptionHtmlSubscriber::setMessage in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/EventSubscriber/WebformDefaultExceptionHtmlSubscriber.php \Drupal\webform\EventSubscriber\WebformDefaultExceptionHtmlSubscriber::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 WebformDefaultExceptionHtmlSubscriber::setMessage()
WebformDefaultExceptionHtmlSubscriber::on403RedirectEntityAccess in src/EventSubscriber/WebformDefaultExceptionHtmlSubscriber.php
Redirect to user login when access is denied for webform or submission.
WebformDefaultExceptionHtmlSubscriber::redirectToLogin in src/EventSubscriber/WebformDefaultExceptionHtmlSubscriber.php
Redirect to user login with destination and display custom message.

File

src/EventSubscriber/WebformDefaultExceptionHtmlSubscriber.php, line 319

Class

WebformDefaultExceptionHtmlSubscriber
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));
}