Ejemplo n.º 1
0
 /**
  * Creates a Message object and adds it to the FlashMessageQueue.
  *
  * @param string $messageBody The message
  * @param string $messageTitle Optional message title
  * @param int $severity Optional severity, must be one of \TYPO3\CMS\Core\Messaging\FlashMessage constants
  * @param bool $storeInSession Optional, defines whether the message should be stored in the session (default) or not
  * @return void
  * @throws \InvalidArgumentException if the message body is no string
  * @see \TYPO3\CMS\Core\Messaging\FlashMessage
  * @api
  */
 public function addFlashMessage($messageBody, $messageTitle = '', $severity = \TYPO3\CMS\Core\Messaging\AbstractMessage::OK, $storeInSession = true)
 {
     if (!is_string($messageBody)) {
         throw new \InvalidArgumentException('The message body must be of type string, "' . gettype($messageBody) . '" given.', 1243258395);
     }
     /* @var \TYPO3\CMS\Core\Messaging\FlashMessage $flashMessage */
     $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class, $messageBody, $messageTitle, $severity, $storeInSession);
     $this->controllerContext->getFlashMessageQueue()->enqueue($flashMessage);
 }
Ejemplo n.º 2
0
 /**
  * @return array An array of flash messages: array<\TYPO3\CMS\Core\Messaging\FlashMessage>
  * @deprecated since 6.1, will be removed 2 versions later
  */
 public function getAllMessagesAndFlush()
 {
     \TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
     return $this->controllerContext->getFlashMessageQueue()->getAllMessagesAndFlush();
 }