[BUGFIX] Conflicting mailform/FORM element in form and compatibility6 00/43500/5
authorOliver Hader <oliver@typo3.org>
Wed, 23 Sep 2015 11:29:57 +0000 (13:29 +0200)
committerFrank Nägler <frank.naegler@typo3.org>
Fri, 25 Sep 2015 08:59:47 +0000 (10:59 +0200)
Depending on the loading order of the extensions compatibility6 and
form, backend configurations are overridden. The behavior should be
that ext:form takes precedence over ext:compatibility6.

Resolves: #70039
Releases: master
Change-Id: I835a2a2c2ce36c6f94013f0d0bcad4825f5ed819
Reviewed-on: http://review.typo3.org/43500
Reviewed-by: Stephan Großberndt <stephan@grossberndt.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
typo3/sysext/compatibility6/Configuration/TCA/Overrides/tt_content.php
typo3/sysext/compatibility6/ext_localconf.php

index 37e3a1e..e1ce513 100644 (file)
@@ -360,7 +360,10 @@ if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('form')) {
                )
        );
 
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem('tt_content', 'CType', array(
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
+               'tt_content',
+               'CType',
+               array(
                        'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:CType.I.8',
                        'mailform',
                        'EXT:t3skin/icons/gfx/i/tt_content_form.gif'
@@ -368,36 +371,35 @@ if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('form')) {
                'search',
                'before'
        );
-}
 
+       // set up the fields
+       $GLOBALS['TCA']['tt_content']['types']['mailform'] = array(
+               'showitem' => '
+                               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
+                               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,
+                               bodytext;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:bodytext.ALT.mailform_formlabel,
+                       --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
+                               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,
+                       --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access,
+                               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.visibility;visibility,
+                               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access,
+                       --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.behaviour,
+                               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.mailform;mailform,
+                       --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.extended'
+       );
+       $baseDefaultExtrasOfBodytext = '';
+       if (!empty($GLOBALS['TCA']['tt_content']['columns']['bodytext']['defaultExtras'])) {
+               $baseDefaultExtrasOfBodytext = $GLOBALS['TCA']['tt_content']['columns']['bodytext']['defaultExtras'] . ':';
+       }
+       if (!is_array($GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides'])) {
+               $GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides'] = array();
+       }
+       if (!is_array($GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides']['bodytext'])) {
+               $GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides']['bodytext'] = array();
+       }
+       $GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides']['bodytext']['defaultExtras'] = $baseDefaultExtrasOfBodytext . 'nowrap:wizards[forms]';
 
-// set up the fields
-$GLOBALS['TCA']['tt_content']['types']['mailform'] = array(
-       'showitem' => '
-               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
-               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,
-               bodytext;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:bodytext.ALT.mailform_formlabel,
-       --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
-               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,
-       --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access,
-               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.visibility;visibility,
-               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access,
-       --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.behaviour,
-               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.mailform;mailform,
-       --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.extended'
-);
-$baseDefaultExtrasOfBodytext = '';
-if (!empty($GLOBALS['TCA']['tt_content']['columns']['bodytext']['defaultExtras'])) {
-       $baseDefaultExtrasOfBodytext = $GLOBALS['TCA']['tt_content']['columns']['bodytext']['defaultExtras'] . ':';
-}
-if (!is_array($GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides'])) {
-       $GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides'] = array();
-}
-if (!is_array($GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides']['bodytext'])) {
-       $GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides']['bodytext'] = array();
-}
-$GLOBALS['TCA']['tt_content']['types']['mailform']['columnsOverrides']['bodytext']['defaultExtras'] = $baseDefaultExtrasOfBodytext . 'nowrap:wizards[forms]';
-
-$GLOBALS['TCA']['tt_content']['palettes']['mailform'] = array(
-       'showitem' => 'pages;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:pages.ALT.mailform, --linebreak--, subheader;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:subheader.ALT.mailform_formlabel',
-);
+       $GLOBALS['TCA']['tt_content']['palettes']['mailform'] = array(
+               'showitem' => 'pages;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:pages.ALT.mailform, --linebreak--, subheader;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:subheader.ALT.mailform_formlabel',
+       );
+}
\ No newline at end of file
index 09b9c60..e520c99 100644 (file)
@@ -40,41 +40,44 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPo
 /**
  * CType "mailform"
  */
-// Add Default TypoScript for CType "mailform" after default content rendering
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScript('compatibility6', 'constants', '<INCLUDE_TYPOSCRIPT: source="FILE:EXT:compatibility6/Configuration/TypoScript/Form/constants.txt">', 'defaultContentRendering');
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScript('compatibility6', 'setup', '<INCLUDE_TYPOSCRIPT: source="FILE:EXT:compatibility6/Configuration/TypoScript/Form/setup.txt">', 'defaultContentRendering');
+// Only apply fallback to plain old FORM/mailform if extension "form" is not loaded
+if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('form')) {
+       // Add Default TypoScript for CType "mailform" after default content rendering
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScript('compatibility6', 'constants', '<INCLUDE_TYPOSCRIPT: source="FILE:EXT:compatibility6/Configuration/TypoScript/Form/constants.txt">', 'defaultContentRendering');
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScript('compatibility6', 'setup', '<INCLUDE_TYPOSCRIPT: source="FILE:EXT:compatibility6/Configuration/TypoScript/Form/setup.txt">', 'defaultContentRendering');
 
-// Add the search CType to the "New Content Element" wizard
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('
-mod.wizards.newContentElement.wizardItems.forms {
-       elements.mailform {
-               iconIdentifier = content-elements-mailform
-               title = LLL:EXT:backend/Resources/Private/Language/locallang_db_new_content_el.xlf:forms_mail_title
-               description = LLL:EXT:backend/Resources/Private/Language/locallang_db_new_content_el.xlf:forms_mail_description
-               tt_content_defValues {
-                       CType = mailform
-                       bodytext (
-               # Example content:
-               Name: | *name = input,40 | Enter your name here
-               Email: | *email=input,40 |
-               Address: | address=textarea,40,5 |
-               Contact me: | tv=check | 1
+       // Add the search CType to the "New Content Element" wizard
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('
+       mod.wizards.newContentElement.wizardItems.forms {
+               elements.mailform {
+                       iconIdentifier = content-elements-mailform
+                       title = LLL:EXT:backend/Resources/Private/Language/locallang_db_new_content_el.xlf:forms_mail_title
+                       description = LLL:EXT:backend/Resources/Private/Language/locallang_db_new_content_el.xlf:forms_mail_description
+                       tt_content_defValues {
+                               CType = mailform
+                               bodytext (
+                       # Example content:
+                       Name: | *name = input,40 | Enter your name here
+                       Email: | *email=input,40 |
+                       Address: | address=textarea,40,5 |
+                       Contact me: | tv=check | 1
 
-               |formtype_mail = submit | Send form!
-               |html_enabled=hidden | 1
-               |subject=hidden| This is the subject
-                       )
+                       |formtype_mail = submit | Send form!
+                       |html_enabled=hidden | 1
+                       |subject=hidden| This is the subject
+                               )
+                       }
                }
+               show :=addToList(mailform)
        }
-       show :=addToList(mailform)
-}
-');
+       ');
 
-// Register for hook to show preview of tt_content element of CType="mailform" in page module
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']['mailform'] = \TYPO3\CMS\Compatibility6\Hooks\PageLayoutView\MailformPreviewRenderer::class;
+       // Register for hook to show preview of tt_content element of CType="mailform" in page module
+       $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']['mailform'] = \TYPO3\CMS\Compatibility6\Hooks\PageLayoutView\MailformPreviewRenderer::class;
 
-// Register for hook to show preview of tt_content element of CType="script" in page module
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']['script'] = \TYPO3\CMS\Compatibility6\Hooks\PageLayoutView\ScriptPreviewRenderer::class;
+       // Register for hook to show preview of tt_content element of CType="script" in page module
+       $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']['script'] = \TYPO3\CMS\Compatibility6\Hooks\PageLayoutView\ScriptPreviewRenderer::class;
+}
 
 /**
  * CType "search"