function DevelGenerateBase::setMessage

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

Set a message for either drush or the web interface.

Parameters

string $msg: The message to display.

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

13 calls to DevelGenerateBase::setMessage()
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.
DevelGenerateBase::generate in devel_generate/src/DevelGenerateBase.php
Execute the instructions in common for all DevelGenerate plugin.
ExampleDevelGenerate::generateElements in devel_generate/tests/modules/devel_generate_example/src/Plugin/DevelGenerate/ExampleDevelGenerate.php
Business logic relating with each DevelGenerate plugin.

... See full list

File

devel_generate/src/DevelGenerateBase.php, line 150

Class

DevelGenerateBase
Provides a base DevelGenerate plugin implementation.

Namespace

Drupal\devel_generate

Code

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