3 namespace Drupal\pathauto;
5 use Drupal\Core\Config\ConfigFactoryInterface;
6 use Drupal\Core\Session\AccountInterface;
9 * Provides a verbose messenger.
11 class VerboseMessenger implements MessengerInterface {
23 * @var \Drupal\Core\Config\ConfigFactoryInterface
25 protected $configFactory;
28 * The current user account.
30 * @var \Drupal\Core\Session\AccountInterface
35 * Creates a verbose messenger.
37 public function __construct(ConfigFactoryInterface $config_factory, AccountInterface $account) {
38 $this->configFactory = $config_factory;
39 $this->account = $account;
45 public function addMessage($message, $op = NULL) {
47 if (!isset($this->isVerbose)) {
48 $config = $this->configFactory->get('pathauto.settings');
49 $this->isVerbose = $config->get('verbose') && $this->account->hasPermission('notify of path changes');
52 if (!$this->isVerbose || (isset($op) && in_array($op, array('bulkupdate', 'return')))) {
57 drupal_set_message($message);