You are here

protected function DevelGenerateBase::setMessage in Devel 4.x

Same name and namespace in other branches
  1. 8.3 devel_generate/src/DevelGenerateBase.php \Drupal\devel_generate\DevelGenerateBase::setMessage()
  2. 8 devel_generate/src/DevelGenerateBase.php \Drupal\devel_generate\DevelGenerateBase::setMessage()
  3. 8.2 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);
  }
}