You are here

public function BynderException::displayMessage in Bynder 4.0.x

Same name and namespace in other branches
  1. 8.3 src/Exception/BynderException.php \Drupal\bynder\Exception\BynderException::displayMessage()
  2. 8 src/Exception/BynderException.php \Drupal\bynder\Exception\BynderException::displayMessage()
  3. 8.2 src/Exception/BynderException.php \Drupal\bynder\Exception\BynderException::displayMessage()

Displays message to the user.

File

src/Exception/BynderException.php, line 62

Class

BynderException
Base exception class for Bynder.

Namespace

Drupal\bynder\Exception

Code

public function displayMessage() {
  if (\Drupal::currentUser()
    ->hasPermission($this->adminPermission)) {
    $this
      ->messenger()
      ->addError($this->adminMessage);
  }
  else {
    $this
      ->messenger()
      ->addError($this
      ->getMessage());
  }
}