From d347054867c534dd70723ef15e1bd02bee09cfee Mon Sep 17 00:00:00 2001
From: Ralf Zimmermann <ralf.zimmermann@tritum.de>
Date: Wed, 13 Sep 2017 12:51:37 +0200
Subject: [PATCH] [BUGFIX] EXT:form - hide readonly elements in summary page
 and emails

Hide readonly form elements within the summary page and emails.

Resolves: #82471
Releases: master, 8.7
Change-Id: I9c42754c935c0b2c62ff1a70f43e7a13d3594f82
Reviewed-on: https://review.typo3.org/54131
Reviewed-by: Daniel Lorenz <daniel.lorenz@extco.de>
Tested-by: Daniel Lorenz <daniel.lorenz@extco.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
---
 .../RenderAllFormValuesViewHelper.php         |  4 +++
 .../form/Configuration/Yaml/BaseSetup.yaml    |  2 ++
 .../Config/configuration/Index.rst            |  4 +++
 .../formElementTypes/ContentElement.rst       |  3 ++
 .../_isReadOnlyFormElement.rst                | 32 +++++++++++++++++++
 .../formElementTypes/StaticText.rst           |  3 ++
 .../_isReadOnlyFormElement.rst                | 32 +++++++++++++++++++
 7 files changed, 80 insertions(+)
 create mode 100644 typo3/sysext/form/Documentation/Config/proto/formElements/formElementTypes/ContentElement/renderingOptions/_isReadOnlyFormElement.rst
 create mode 100644 typo3/sysext/form/Documentation/Config/proto/formElements/formElementTypes/StaticText/renderingOptions/_isReadOnlyFormElement.rst

diff --git a/typo3/sysext/form/Classes/ViewHelpers/RenderAllFormValuesViewHelper.php b/typo3/sysext/form/Classes/ViewHelpers/RenderAllFormValuesViewHelper.php
index 61cfce738d80..97bd42997d2f 100644
--- a/typo3/sysext/form/Classes/ViewHelpers/RenderAllFormValuesViewHelper.php
+++ b/typo3/sysext/form/Classes/ViewHelpers/RenderAllFormValuesViewHelper.php
@@ -91,6 +91,10 @@ class RenderAllFormValuesViewHelper extends AbstractViewHelper
                     isset($renderingOptions['_isHiddenFormElement'])
                     && $renderingOptions['_isHiddenFormElement'] === true
                 )
+                || (
+                    isset($renderingOptions['_isReadOnlyFormElement'])
+                    && $renderingOptions['_isReadOnlyFormElement'] === true
+                )
             ) {
                 continue;
             }
diff --git a/typo3/sysext/form/Configuration/Yaml/BaseSetup.yaml b/typo3/sysext/form/Configuration/Yaml/BaseSetup.yaml
index 2b088eeb62a5..7fc3d8b9245b 100644
--- a/typo3/sysext/form/Configuration/Yaml/BaseSetup.yaml
+++ b/typo3/sysext/form/Configuration/Yaml/BaseSetup.yaml
@@ -381,6 +381,8 @@ TYPO3:
             __inheritances:
               10: 'TYPO3.CMS.Form.mixins.formElementMixins.BaseFormElementMixin'
             implementationClassName: 'TYPO3\CMS\Form\Domain\Model\FormElements\GenericFormElement'
+            renderingOptions:
+              _isReadOnlyFormElement: true
 
           FormElementMixin:
             __inheritances:
diff --git a/typo3/sysext/form/Documentation/Config/configuration/Index.rst b/typo3/sysext/form/Documentation/Config/configuration/Index.rst
index 56c6f8842b9c..f3cab2bacdf0 100644
--- a/typo3/sysext/form/Documentation/Config/configuration/Index.rst
+++ b/typo3/sysext/form/Documentation/Config/configuration/Index.rst
@@ -3202,6 +3202,8 @@ Full default configuration
               enableDatePicker: true
               displayTimeSelector: false
           StaticText:
+            renderingOptions:
+              _isReadOnlyFormElement: true
             formEditor:
               editors:
                 100:
@@ -3231,6 +3233,8 @@ Full default configuration
             properties:
               text: ''
           ContentElement:
+            renderingOptions:
+              _isReadOnlyFormElement: true
             formEditor:
               editors:
                 100:
diff --git a/typo3/sysext/form/Documentation/Config/proto/formElements/formElementTypes/ContentElement.rst b/typo3/sysext/form/Documentation/Config/proto/formElements/formElementTypes/ContentElement.rst
index 6c5312f343c0..037d7ab2a396 100644
--- a/typo3/sysext/form/Documentation/Config/proto/formElements/formElementTypes/ContentElement.rst
+++ b/typo3/sysext/form/Documentation/Config/proto/formElements/formElementTypes/ContentElement.rst
@@ -15,6 +15,9 @@ Properties
 .. _typo3.cms.form.prototypes.<prototypeIdentifier>.formelementsdefinition.contentelement.implementationclassname:
 .. include:: ContentElement/implementationClassName.rst
 
+.. _typo3.cms.form.prototypes.<prototypeIdentifier>.formelementsdefinition.contentelement.renderingoptions._isReadOnlyFormElement:
+.. include:: ContentElement/renderingOptions/_isReadOnlyFormElement.rst
+
 .. _typo3.cms.form.prototypes.<prototypeIdentifier>.formelementsdefinition.contentelement.properties.contentelementuid:
 .. include:: ContentElement/properties/contentElementUid.rst
 
diff --git a/typo3/sysext/form/Documentation/Config/proto/formElements/formElementTypes/ContentElement/renderingOptions/_isReadOnlyFormElement.rst b/typo3/sysext/form/Documentation/Config/proto/formElements/formElementTypes/ContentElement/renderingOptions/_isReadOnlyFormElement.rst
new file mode 100644
index 000000000000..98b2b523cfd5
--- /dev/null
+++ b/typo3/sysext/form/Documentation/Config/proto/formElements/formElementTypes/ContentElement/renderingOptions/_isReadOnlyFormElement.rst
@@ -0,0 +1,32 @@
+renderingOptions._isReadOnlyFormElement
+---------------------------------------
+
+:aspect:`Option path`
+      TYPO3.CMS.Form.prototypes.<prototypeIdentifier>.formElementsDefinition.ContentElement.renderingOptions._isReadOnlyFormElement
+
+:aspect:`Data type`
+      bool
+
+:aspect:`Needed by`
+      Frontend
+
+:aspect:`Overwritable within form definition`
+      Yes
+
+:aspect:`form editor can write this property into the form definition (for prototype 'standard')`
+      No
+
+:aspect:`Mandatory`
+      No
+
+:aspect:`Default value (for prototype 'standard')`
+      .. code-block:: yaml
+         :linenos:
+         :emphasize-lines: 3
+
+         ContentElement:
+           renderingOptions:
+             _isReadOnlyFormElement: true
+
+:aspect:`Description`
+      Internal control setting to define that the form element is not visible within the summary page and emails.
\ No newline at end of file
diff --git a/typo3/sysext/form/Documentation/Config/proto/formElements/formElementTypes/StaticText.rst b/typo3/sysext/form/Documentation/Config/proto/formElements/formElementTypes/StaticText.rst
index 5b6854930687..20ba50d1f667 100644
--- a/typo3/sysext/form/Documentation/Config/proto/formElements/formElementTypes/StaticText.rst
+++ b/typo3/sysext/form/Documentation/Config/proto/formElements/formElementTypes/StaticText.rst
@@ -15,6 +15,9 @@ Properties
 .. _typo3.cms.form.prototypes.<prototypeIdentifier>.formelementsdefinition.statictext.implementationclassname:
 .. include:: StaticText/implementationClassName.rst
 
+.. _typo3.cms.form.prototypes.<prototypeIdentifier>.formelementsdefinition.statictext.renderingoptions._isReadOnlyFormElement:
+.. include:: StaticText/renderingOptions/_isReadOnlyFormElement.rst
+
 .. _typo3.cms.form.prototypes.<prototypeIdentifier>.formelementsdefinition.statictext.properties.text:
 .. include:: StaticText/properties/text.rst
 
diff --git a/typo3/sysext/form/Documentation/Config/proto/formElements/formElementTypes/StaticText/renderingOptions/_isReadOnlyFormElement.rst b/typo3/sysext/form/Documentation/Config/proto/formElements/formElementTypes/StaticText/renderingOptions/_isReadOnlyFormElement.rst
new file mode 100644
index 000000000000..f4d0c0a35ffb
--- /dev/null
+++ b/typo3/sysext/form/Documentation/Config/proto/formElements/formElementTypes/StaticText/renderingOptions/_isReadOnlyFormElement.rst
@@ -0,0 +1,32 @@
+renderingOptions._isReadOnlyFormElement
+---------------------------------------
+
+:aspect:`Option path`
+      TYPO3.CMS.Form.prototypes.<prototypeIdentifier>.formElementsDefinition.StaticText.renderingOptions._isReadOnlyFormElement
+
+:aspect:`Data type`
+      bool
+
+:aspect:`Needed by`
+      Frontend
+
+:aspect:`Overwritable within form definition`
+      Yes
+
+:aspect:`form editor can write this property into the form definition (for prototype 'standard')`
+      No
+
+:aspect:`Mandatory`
+      No
+
+:aspect:`Default value (for prototype 'standard')`
+      .. code-block:: yaml
+         :linenos:
+         :emphasize-lines: 3
+
+         StaticText:
+           renderingOptions:
+             _isReadOnlyFormElement: true
+
+:aspect:`Description`
+      Internal control setting to define that the form element is not visible within the summary page and emails.
\ No newline at end of file
-- 
GitLab