You are here

public function ReadonlymodeManager::onRequest in Read only mode 2.0.x

Set the readonly mode message on every request.

File

src/ReadonlymodeManager.php, line 142

Class

ReadonlymodeManager
The manager class for the read only mode.

Namespace

Drupal\readonlymode

Code

public function onRequest() {
  if ($this
    ->isReadonly() && $this->account
    ->hasPermission('see readonlymode warning')) {
    $this->messenger
      ->addWarning($this
      ->getWarningMessage());
  }
}