function DevelGenerateBase::setMessage

Same name in other branches
  1. 8.x-1.x devel_generate/src/DevelGenerateBase.php \Drupal\devel_generate\DevelGenerateBase::setMessage()
  2. 4.x devel_generate/src/DevelGenerateBase.php \Drupal\devel_generate\DevelGenerateBase::setMessage()

Set a message for either drush or the web interface.

Parameters

string|\Drupal\Component\Render\MarkupInterface $msg: The message to display.

string $type: (optional) The message type, as defined in MessengerInterface. Defaults to MessengerInterface::TYPE_STATUS.

15 calls to DevelGenerateBase::setMessage()
BlockContentDevelGenerate::contentKill in devel_generate/src/Plugin/DevelGenerate/BlockContentDevelGenerate.php
Deletes all blocks of given block content types.
BlockContentDevelGenerate::generateContent in devel_generate/src/Plugin/DevelGenerate/BlockContentDevelGenerate.php
Generate content when not in batch mode.
ContentDevelGenerate::contentKill in devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php
Deletes all nodes of given node types.
ContentDevelGenerate::generateContent in devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php
Generate content when not in batch mode.
ContentDevelGenerate::settingsForm in devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php
Returns the form for the plugin.

... See full list

File

devel_generate/src/DevelGenerateBase.php, line 181

Class

DevelGenerateBase
Provides a base DevelGenerate plugin implementation.

Namespace

Drupal\devel_generate

Code

protected function setMessage($msg, string $type = MessengerInterface::TYPE_STATUS) : void {
    if (function_exists('drush_log')) {
        $msg = strip_tags($msg);
        drush_log($msg);
    }
    else {
        $this->messenger
            ->addMessage($msg, $type);
    }
}