TYPO3 CMS  TYPO3_6-2
FlashMessageContainer.php
Go to the documentation of this file.
1 <?php
3 
34 
38  protected $controllerContext;
39 
44  public function setControllerContext(\TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext $controllerContext) {
45  $this->controllerContext = $controllerContext;
46  }
47 
64  public function add($message, $title = '', $severity = \TYPO3\CMS\Core\Messaging\FlashMessage::OK) {
66  if (!is_string($message)) {
67  throw new \InvalidArgumentException(
68  'The flash message must be string, ' . gettype($message) . ' given.',
69  1243258396
70  );
71  }
74  'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $message, $title, $severity, TRUE
75  );
76  $this->controllerContext->getFlashMessageQueue()->enqueue($flashMessage);
77  }
78 
83  public function getAllMessages() {
85  return $this->controllerContext->getFlashMessageQueue()->getAllMessages();
86  }
87 
92  public function flush() {
94  $this->controllerContext->getFlashMessageQueue()->getAllMessagesAndFlush();
95  }
96 
101  public function getAllMessagesAndFlush() {
103  return $this->controllerContext->getFlashMessageQueue()->getAllMessagesAndFlush();
104  }
105 }
setControllerContext(\TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext $controllerContext)