From a15d819f5899d659396730e922f0dfc18934f535 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Frank=20Na=CC=88gler?= <frank.naegler@typo3.org>
Date: Mon, 2 Nov 2015 16:49:37 +0100
Subject: [PATCH] [TASK] Streamline output of flashMessages in BE

Resolves: #71249
Relaeses: master
Change-Id: I5be260c96e6ae689a6716efe6a059e697f184872
Reviewed-on: https://review.typo3.org/44479
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Tested-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
---
 .../sysext/beuser/Resources/Private/Layouts/Default.html | 6 +++++-
 typo3/sysext/core/Classes/Messaging/FlashMessage.php     | 9 +++++++++
 .../documentation/Resources/Private/Layouts/Default.html | 6 +++++-
 .../extensionmanager/Resources/Private/Layouts/Main.html | 6 +++++-
 .../Private/Templates/List/UnresolvedDependencies.html   | 9 +++++++--
 .../filelist/Resources/Private/Layouts/Default.html      | 8 ++++++--
 .../Templates/Administration/StatisticDetails.html       | 8 ++++++--
 .../Private/Templates/Language/ListLanguages.html        | 6 +++++-
 .../Private/Templates/Language/ListTranslations.html     | 6 +++++-
 .../recycler/Resources/Private/Layouts/Default.html      | 6 +++++-
 .../workspaces/Resources/Private/Layouts/Module.html     | 8 ++++++--
 .../workspaces/Resources/Private/Layouts/Nodoc.html      | 6 +++++-
 12 files changed, 69 insertions(+), 15 deletions(-)

diff --git a/typo3/sysext/beuser/Resources/Private/Layouts/Default.html b/typo3/sysext/beuser/Resources/Private/Layouts/Default.html
index 43895493b12a..f9e814a33c33 100644
--- a/typo3/sysext/beuser/Resources/Private/Layouts/Default.html
+++ b/typo3/sysext/beuser/Resources/Private/Layouts/Default.html
@@ -2,6 +2,10 @@
 
 <f:render section="headline" />
 
-<f:flashMessages />
+<f:flashMessages as="flashMessages">
+	<f:for each="{flashMessages}" as="flashMessage">
+		{flashMessage}
+	</f:for>
+</f:flashMessages>
 
 <f:render section="content" />
diff --git a/typo3/sysext/core/Classes/Messaging/FlashMessage.php b/typo3/sysext/core/Classes/Messaging/FlashMessage.php
index 186f2544859a..719b49abc6fb 100644
--- a/typo3/sysext/core/Classes/Messaging/FlashMessage.php
+++ b/typo3/sysext/core/Classes/Messaging/FlashMessage.php
@@ -134,4 +134,13 @@ class FlashMessage extends AbstractMessage
 			</div>';
         return $message;
     }
+
+    /**
+     * Renders the flash message, makes it possible to render a flashMessage in a fluid view.
+     *
+     * @return string
+     */
+    public function __toString() {
+        return $this->render();
+    }
 }
diff --git a/typo3/sysext/documentation/Resources/Private/Layouts/Default.html b/typo3/sysext/documentation/Resources/Private/Layouts/Default.html
index 7fdff46c7d5c..f3c0e8fc5554 100644
--- a/typo3/sysext/documentation/Resources/Private/Layouts/Default.html
+++ b/typo3/sysext/documentation/Resources/Private/Layouts/Default.html
@@ -1,5 +1,9 @@
 <div class="typo3-documentation">
 	<f:render section="module-headline" />
-	<f:flashMessages />
+	<f:flashMessages as="flashMessages">
+		<f:for each="{flashMessages}" as="flashMessage">
+			{flashMessage}
+		</f:for>
+	</f:flashMessages>
 	<f:render section="Content" />
 </div>
diff --git a/typo3/sysext/extensionmanager/Resources/Private/Layouts/Main.html b/typo3/sysext/extensionmanager/Resources/Private/Layouts/Main.html
index f60c3d81104f..2dca2733c34d 100644
--- a/typo3/sysext/extensionmanager/Resources/Private/Layouts/Main.html
+++ b/typo3/sysext/extensionmanager/Resources/Private/Layouts/Main.html
@@ -15,6 +15,10 @@
 	}"
 	/>
 <f:render section="headline" />
-<f:flashMessages />
+<f:flashMessages as="flashMessages">
+	<f:for each="{flashMessages}" as="flashMessage">
+		{flashMessage}
+	</f:for>
+</f:flashMessages>
 
 <f:render section="content" />
diff --git a/typo3/sysext/extensionmanager/Resources/Private/Templates/List/UnresolvedDependencies.html b/typo3/sysext/extensionmanager/Resources/Private/Templates/List/UnresolvedDependencies.html
index 42aa024a8a4e..3ed2957e747a 100644
--- a/typo3/sysext/extensionmanager/Resources/Private/Templates/List/UnresolvedDependencies.html
+++ b/typo3/sysext/extensionmanager/Resources/Private/Templates/List/UnresolvedDependencies.html
@@ -7,7 +7,12 @@
 </f:section>
 
 <f:section name="content">
-	<f:flashMessages />
+	<f:flashMessages as="flashMessages">
+		<f:for each="{flashMessages}" as="flashMessage">
+			{flashMessage}
+		</f:for>
+	</f:flashMessages>
+
 	<f:render partial="List/UnresolvedDependencies" arguments="{_all}" />
 	<f:be.infobox title="{f:translate(key: 'dependencyCheck.unresolvedDependencies.title')}" state="1">
 		<f:render partial="List/UnresolvedDependenciesMessage" />
@@ -18,4 +23,4 @@
 	<f:link.action action="installExtensionWithoutSystemDependencyCheck" controller="Action" arguments="{extensionKey: extension.extensionKey}" class="btn btn-default t3js-dependencies disabled onClickMaskExtensionManager">
 		<span class="t3-icon t3-icon-actions t3-icon-dialog-error">&nbsp;</span> <f:translate key="dependencyCheck.unresolvedDependencies.proceed" />
 	</f:link.action>
-</f:section>
\ No newline at end of file
+</f:section>
diff --git a/typo3/sysext/filelist/Resources/Private/Layouts/Default.html b/typo3/sysext/filelist/Resources/Private/Layouts/Default.html
index 162d368b06d5..3cf7a5f552f1 100644
--- a/typo3/sysext/filelist/Resources/Private/Layouts/Default.html
+++ b/typo3/sysext/filelist/Resources/Private/Layouts/Default.html
@@ -1,8 +1,12 @@
 <f:render section="headline" />
-<f:flashMessages queueIdentifier="core.template.flashMessages" />
+<f:flashMessages as="flashMessages" queueIdentifier="core.template.flashMessages">
+	<f:for each="{flashMessages}" as="flashMessage">
+		{flashMessage}
+	</f:for>
+</f:flashMessages>
 <f:render section="content" />
 
 <div class="t3js-drag-uploader" data-target-folder="{folderIdentifier}" data-progress-container="#typo3-filelist"
 	 data-dropzone-trigger=".t3js-drag-uploader-trigger" data-dropzone-target=".t3js-module-body h1:first"
 	 data-file-deny-pattern="{fileDenyPattern}" data-max-file-size="{maxFileSize}"
-	></div>
\ No newline at end of file
+	></div>
diff --git a/typo3/sysext/indexed_search/Resources/Private/Templates/Administration/StatisticDetails.html b/typo3/sysext/indexed_search/Resources/Private/Templates/Administration/StatisticDetails.html
index add1c334cf0d..3b255f558f65 100644
--- a/typo3/sysext/indexed_search/Resources/Private/Templates/Administration/StatisticDetails.html
+++ b/typo3/sysext/indexed_search/Resources/Private/Templates/Administration/StatisticDetails.html
@@ -5,7 +5,11 @@
 
 <f:section name="Content">
 	<p class="lead"><f:translate key="administration.document.description"/></p>
-	<f:flashMessages />
+	<f:flashMessages as="flashMessages">
+		<f:for each="{flashMessages}" as="flashMessage">
+			{flashMessage}
+		</f:for>
+	</f:flashMessages>
 	<f:if condition="{phashRow}">
 		<f:then>
 			<table class="table table-striped table-hover">
@@ -192,4 +196,4 @@
 
 		</f:form>
 	</f:if>
-</f:section>
\ No newline at end of file
+</f:section>
diff --git a/typo3/sysext/lang/Resources/Private/Templates/Language/ListLanguages.html b/typo3/sysext/lang/Resources/Private/Templates/Language/ListLanguages.html
index d25cd9cbbda0..96e0a1393e54 100644
--- a/typo3/sysext/lang/Resources/Private/Templates/Language/ListLanguages.html
+++ b/typo3/sysext/lang/Resources/Private/Templates/Language/ListLanguages.html
@@ -9,7 +9,11 @@
 	<h1>
 		<f:translate key="header.languages"/>
 	</h1>
-	<f:flashMessages/>
+	<f:flashMessages as="flashMessages">
+		<f:for each="{flashMessages}" as="flashMessage">
+			{flashMessage}
+		</f:for>
+	</f:flashMessages>
 	<form class="form-inline">
 		<div class="form-group">
 			<f:form.textfield name="typo3-language-searchfield" placeholder="{f:translate(key:'table.search')}"
diff --git a/typo3/sysext/lang/Resources/Private/Templates/Language/ListTranslations.html b/typo3/sysext/lang/Resources/Private/Templates/Language/ListTranslations.html
index 1f7eea7c5876..a79c0f7d668d 100644
--- a/typo3/sysext/lang/Resources/Private/Templates/Language/ListTranslations.html
+++ b/typo3/sysext/lang/Resources/Private/Templates/Language/ListTranslations.html
@@ -2,7 +2,11 @@
 
 <f:section name="content">
 	<h1><f:translate key="header.translations" /></h1>
-	<f:flashMessages />
+	<f:flashMessages as="flashMessages">
+		<f:for each="{flashMessages}" as="flashMessage">
+			{flashMessage}
+		</f:for>
+	</f:flashMessages>
 	<form class="form-inline">
 		<div class="form-group">
 			<f:form.textfield name="typo3-language-searchfield" placeholder="{f:translate(key:'table.search')}" id="typo3-language-searchfield" value="{search}" class="form-control t3js-language-searchfield" />
diff --git a/typo3/sysext/recycler/Resources/Private/Layouts/Default.html b/typo3/sysext/recycler/Resources/Private/Layouts/Default.html
index cb361978eab9..2732da54ccdc 100644
--- a/typo3/sysext/recycler/Resources/Private/Layouts/Default.html
+++ b/typo3/sysext/recycler/Resources/Private/Layouts/Default.html
@@ -1,4 +1,8 @@
 <f:be.pageRenderer includeRequireJsModules="{0:'TYPO3/CMS/Recycler/Recycler'}" />
 <h1><f:translate key="title" /></h1>
-<f:flashMessages />
+<f:flashMessages as="flashMessages">
+	<f:for each="{flashMessages}" as="flashMessage">
+		{flashMessage}
+	</f:for>
+</f:flashMessages>
 <f:render section="content" />
diff --git a/typo3/sysext/workspaces/Resources/Private/Layouts/Module.html b/typo3/sysext/workspaces/Resources/Private/Layouts/Module.html
index 9fe98a141f48..b5a215ae98ff 100644
--- a/typo3/sysext/workspaces/Resources/Private/Layouts/Module.html
+++ b/typo3/sysext/workspaces/Resources/Private/Layouts/Module.html
@@ -1,5 +1,9 @@
 <f:if condition="{pageTitle}"><h1>{pageTitle}</h1></f:if>
-<f:flashMessages />
+<f:flashMessages as="flashMessages">
+	<f:for each="{flashMessages}" as="flashMessage">
+		{flashMessage}
+	</f:for>
+</f:flashMessages>
 <div id="workspacetabs"></div>
 <div class="well well-sm"><f:render section="main" /></div>
-<f:if condition="{showLegend}"><f:render partial="legend" /></f:if>
\ No newline at end of file
+<f:if condition="{showLegend}"><f:render partial="legend" /></f:if>
diff --git a/typo3/sysext/workspaces/Resources/Private/Layouts/Nodoc.html b/typo3/sysext/workspaces/Resources/Private/Layouts/Nodoc.html
index 7fcd5a34da60..3bc0693a361a 100644
--- a/typo3/sysext/workspaces/Resources/Private/Layouts/Nodoc.html
+++ b/typo3/sysext/workspaces/Resources/Private/Layouts/Nodoc.html
@@ -3,7 +3,11 @@
 	<div id="typo3-docbody">
 		<div id="typo3-inner-docbody">
 
-			<f:flashMessages />
+			<f:flashMessages as="flashMessages">
+				<f:for each="{flashMessages}" as="flashMessage">
+					{flashMessage}
+				</f:for>
+			</f:flashMessages>
 
 			<f:render section="main"/>
 		</div>
-- 
GitLab