41 lines
1.3 KiB
PHP
41 lines
1.3 KiB
PHP
<?php
|
|
declare(strict_types = 1);
|
|
namespace TYPO3\CMS\Scheduler;
|
|
|
|
/*
|
|
* This file is part of the TYPO3 CMS project.
|
|
*
|
|
* It is free software; you can redistribute it and/or modify it under
|
|
* the terms of the GNU General Public License, either version 2
|
|
* of the License, or any later version.
|
|
*
|
|
* For the full copyright and license information, please read the
|
|
* LICENSE.txt file that was distributed with this source code.
|
|
*
|
|
* The TYPO3 project - inspiring people to share!
|
|
*/
|
|
|
|
use TYPO3\CMS\Core\Messaging\FlashMessage;
|
|
use TYPO3\CMS\Core\Messaging\FlashMessageService;
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
|
|
|
/**
|
|
* Base class for providers of additional fields
|
|
*/
|
|
abstract class AbstractAdditionalFieldProvider implements AdditionalFieldProviderInterface
|
|
{
|
|
/**
|
|
* Add a flash message
|
|
*
|
|
* @param string $message the flash message content
|
|
* @param int $severity the flash message severity
|
|
*/
|
|
protected function addMessage(string $message, int $severity = FlashMessage::OK): void
|
|
{
|
|
$flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $message, '', $severity);
|
|
$service = GeneralUtility::makeInstance(FlashMessageService::class);
|
|
$queue = $service->getMessageQueueByIdentifier();
|
|
$queue->enqueue($flashMessage);
|
|
}
|
|
}
|