You are here

public function VerboseMessenger::addMessage in Pathauto 8

Adds a message.

Parameters

string $message: The message to add.

string $op: (optional) The operation being performed.

Overrides MessengerInterface::addMessage

File

src/VerboseMessenger.php, line 61

Class

VerboseMessenger
Provides a verbose messenger.

Namespace

Drupal\pathauto

Code

public function addMessage($message, $op = NULL) {
  if (!isset($this->isVerbose)) {
    $config = $this->configFactory
      ->get('pathauto.settings');
    $this->isVerbose = $config
      ->get('verbose') && $this->account
      ->hasPermission('notify of path changes');
  }
  if (!$this->isVerbose || isset($op) && in_array($op, [
    'bulkupdate',
    'return',
  ])) {
    return FALSE;
  }
  if ($message) {
    $this->messenger
      ->addMessage($message);
  }
  return TRUE;
}