2 namespace TYPO3\CMS\Fluid\ViewHelpers;
105 $this->
registerArgument(
'queueIdentifier',
'string',
'Flash-message queue to use',
false);
119 public function render($renderMode = null, $as = null)
121 $queueIdentifier = isset($this->arguments[
'queueIdentifier']) ? $this->arguments[
'queueIdentifier'] : null;
122 $flashMessages = $this->controllerContext->getFlashMessageQueue($queueIdentifier)->getAllMessagesAndFlush();
123 if ($flashMessages === null || count($flashMessages) === 0) {
126 if ($renderMode !== null) {
128 if ($renderMode === self::RENDER_MODE_DIV) {
129 $content = $this->
renderDiv($flashMessages);
131 $content = $this->renderAsList($flashMessages);
135 $content = $this->renderAsList($flashMessages);
150 protected function renderAsList(array $flashMessages)
152 $flashMessagesClass = $this->
hasArgument(
'class') ? $this->arguments[
'class'] :
'typo3-messages';
154 $this->tag->addAttribute(
'class', $flashMessagesClass);
156 foreach ($flashMessages as $singleFlashMessage) {
157 $severityClass = sprintf(
'alert %s', $singleFlashMessage->getClass());
158 $messageContent = htmlspecialchars($singleFlashMessage->getMessage());
159 if ($singleFlashMessage->getTitle() !==
'') {
160 $messageContent = sprintf(
'<h4>%s</h4>', htmlspecialchars($singleFlashMessage->getTitle())) . $messageContent;
162 $tagContent .= sprintf(
'<li class="%s">%s</li>', htmlspecialchars($severityClass), $messageContent);
164 $this->tag->setContent($tagContent);
165 return $this->tag->render();
197 $this->tag->setTagName(
'div');
199 $this->tag->addAttribute(
'class', $this->arguments[
'class']);
201 $this->tag->addAttribute(
'class',
'typo3-messages');
204 foreach ($flashMessages as $singleFlashMessage) {
205 $tagContent .= $singleFlashMessage->render();
207 $this->tag->setContent($tagContent);
208 return $this->tag->render();