public function CliCommandsInterface::create in Site Alert 8
Creates a new site alert.
Parameters
string $label: The label of the site alert.
string $message: The message to put in the site alert.
array $options: Array of optional human readable values to set on the site alert, passed on the command line. The following values can be set:
- start: The start date, in ISO 8601 format.
- end: The end date, in ISO 8601 format.
- active: Optional boolean value indicating if the created alert will be activated. If omitted or set to TRUE, the alert will be active. If set to FALSE it will be inactive.
- severity: The severity level, can be 'low', 'medium' or 'high'. If omitted or any other value this will default to 'medium'.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException Thrown when the Site Alert entity definition is invalid.
\Drupal\Component\Plugin\Exception\PluginNotFoundException Thrown when the Site Alert entity type is not defined.
\Drupal\Core\Entity\EntityStorageException Thrown when an error occurs during the saving of the site alert.
\InvalidArgumentException Thrown in case one of the passed in arguments or options is invalid.
1 method overrides CliCommandsInterface::create()
- CliCommands::create in src/
CliCommands.php - Creates a new site alert.
File
- src/
CliCommandsInterface.php, line 39
Class
- CliCommandsInterface
- Interface for a service with shared code for CLI tools.
Namespace
Drupal\site_alertCode
public function create(string $label, string $message, array $options) : void;