[!!!][TASK] Remove example image in TS constants description 22/48922/6
authorBenni Mack <benni@typo3.org>
Tue, 12 Jul 2016 09:57:34 +0000 (11:57 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Thu, 14 Jul 2016 08:46:27 +0000 (10:46 +0200)
In TYPO3 it was possible to show an image for a category in
the Constants Editor, if the constants editor had configured a category
like this (also defined in the Constants Editor):

TSConstantEditor.basic.image = EXT:sys_note/ext_icon.png

As the functionality is hardly used and better options for styling
and displaying images e.g. via user functions is possible, the
image option has been removed.

With that, the following breaking changes in the related PHP code
happened:
- Removed ExtendedTemplateService::$ext_localGfxPrefix
- Removed ExtendedTemplateService::$ext_localWebGfxPrefix
- Removed ExtendedTemplateService::ext_getTSCE_config_image
- Removed ConfigurationForm::ext_getTSCE_config_image
- Dropped parameter 2+3 of ConfigurationForm::ext_initTSstyleConfig

Resolves: #77062
Releases: master
Change-Id: Ic7d89aeaa4f236a92a07dd2fe0a25dbe026825cb
Reviewed-on: https://review.typo3.org/48922
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Thomas Schlumberger <thomas@b13.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/core/Classes/TypoScript/ConfigurationForm.php
typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php
typo3/sysext/core/Documentation/Changelog/master/Breaking-77062-ExampleImageInTSConstantsDescriptionsRemoved.rst [new file with mode: 0644]
typo3/sysext/extensionmanager/Classes/Utility/ConfigurationUtility.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/ConfigurationUtilityTest.php
typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateConstantEditorModuleFunctionController.php

index ff26415..565950c 100644 (file)
@@ -54,19 +54,15 @@ class ConfigurationForm extends ExtendedTemplateService
 
     /**
      * @param string $configTemplate
-     * @param string $pathRel PathRel is the path relative to the typo3/ directory
-     * @param string $pathAbs PathAbs is the absolute path from root
      * @return array
      */
-    public function ext_initTSstyleConfig($configTemplate, $pathRel, $pathAbs)
+    public function ext_initTSstyleConfig($configTemplate)
     {
         // Do not log time-performance information
         $this->tt_track = 0;
         $this->constants = array($configTemplate, '');
         // The editable constants are returned in an array.
         $theConstants = $this->generateConfig_constants();
-        $this->ext_localGfxPrefix = $pathAbs;
-        $this->ext_localWebGfxPrefix = $pathRel;
         return $theConstants;
     }
 
@@ -153,9 +149,8 @@ class ConfigurationForm extends ExtendedTemplateService
     public function ext_displayExample()
     {
         $out = '';
-        if ($this->helpConfig['imagetag'] || $this->helpConfig['description'] || $this->helpConfig['header']) {
-            $out = '<div align="center">' . $this->helpConfig['imagetag'] . '</div><br />'
-                . ($this->helpConfig['description'] ? implode(explode('//', $this->helpConfig['description']), '<br />') . '<br />' : '')
+        if ($this->helpConfig['description'] || $this->helpConfig['header']) {
+            $out = ($this->helpConfig['description'] ? implode(explode('//', $this->helpConfig['description']), '<br />') . '<br />' : '')
                 . ($this->helpConfig['bulletlist'] ? '<ul><li>' . implode(explode('//', $this->helpConfig['bulletlist']), '<li>') . '</ul>' : '<BR>');
         }
         return $out;
@@ -177,18 +172,6 @@ class ConfigurationForm extends ExtendedTemplateService
     }
 
     /**
-     * @param string $imgConf
-     * @return string
-     */
-    public function ext_getTSCE_config_image($imgConf)
-    {
-        $iFile = $this->ext_localGfxPrefix . $imgConf;
-        $tFile = $this->ext_localWebGfxPrefix . $imgConf;
-        $imageInfo = @getimagesize($iFile);
-        return '<img src="' . $tFile . '" ' . $imageInfo[3] . '>';
-    }
-
-    /**
      * @param array $params
      * @return array
      */
index 6b43eb6..83653e4 100644 (file)
@@ -24,7 +24,6 @@ use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
-use TYPO3\CMS\Core\Utility\PathUtility;
 use TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher;
 use TYPO3\CMS\Lang\LanguageService;
 
@@ -152,16 +151,6 @@ class ExtendedTemplateService extends TemplateService
     public $ext_lineNumberOffset = 0;
 
     /**
-     * @var string
-     */
-    public $ext_localGfxPrefix = '';
-
-    /**
-     * @var string
-     */
-    public $ext_localWebGfxPrefix = '';
-
-    /**
      * @var int
      */
     public $ext_expandAllNotes = 0;
@@ -1112,9 +1101,6 @@ class ExtendedTemplateService extends TemplateService
         if (is_array($catConf)) {
             foreach ($catConf as $key => $val) {
                 switch ($key) {
-                    case 'image':
-                        $out['imagetag'] = $this->ext_getTSCE_config_image($catConf['image']);
-                        break;
                     case 'description':
                     case 'bulletlist':
                     case 'header':
@@ -1137,30 +1123,6 @@ class ExtendedTemplateService extends TemplateService
     }
 
     /**
-     * @param string $imgConf
-     * @return string
-     */
-    public function ext_getTSCE_config_image($imgConf)
-    {
-        $iFile = null;
-        $tFile = null;
-        if (substr($imgConf, 0, 4) == 'gfx/') {
-            $iFile = $this->ext_localGfxPrefix . $imgConf;
-            $tFile = $this->ext_localWebGfxPrefix . $imgConf;
-        } elseif (substr($imgConf, 0, 4) == 'EXT:') {
-            $iFile = GeneralUtility::getFileAbsFileName($imgConf);
-            if ($iFile) {
-                $tFile = '../' . PathUtility::stripPathSitePrefix($iFile);
-            }
-        }
-        if ($iFile !== null) {
-            $imageInfo = @getimagesize($iFile);
-            return '<img src="' . $tFile . '" ' . $imageInfo[3] . '>';
-        }
-        return '';
-    }
-
-    /**
      * @param array $params
      * @return array
      */
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-77062-ExampleImageInTSConstantsDescriptionsRemoved.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-77062-ExampleImageInTSConstantsDescriptionsRemoved.rst
new file mode 100644 (file)
index 0000000..3117c6c
--- /dev/null
@@ -0,0 +1,47 @@
+=====================================================================
+Breaking: #77062 - Example image in TS constants descriptions removed
+=====================================================================
+
+Description
+===========
+
+In previous TYPO3 versions it was possible to add help text and and an help image to a certain category or
+configuration option in the TypoScript Constant Editor of the TYPO3 Backend. This was previously done via an
+additional Constant Editor option within the ``TSConstantEditor`` object.
+
+The functionality has been removed without substitution.
+
+Along with that change, the following PHP methods have been removed:
+- ExtendedTemplateService::ext_getTSCE_config_image()
+- ConfigurationForm::ext_getTSCE_config_image()
+
+The following public properties have been removed:
+- ExtendedTemplateService::$ext_localGfxPrefix
+- ExtendedTemplateService::$ext_localWebGfxPrefix
+
+Within ``ConfigurationForm::ext_initTSstyleConfig()`` the second and third parameter have been removed.
+
+
+Impact
+======
+
+Setting an option ``TSConstantEditor.basic.image = EXT:sys_note/ext_icon.png`` for a category or configuration option in TypoScript constants has no effect anymore.
+
+Calling any of the removed methods will result in a fatal PHP error.
+
+Using any of the removed properties will result in a PHP warning.
+
+Calling ``ConfigurationForm::ext_initTSstyleConfig()`` with the second or third parameter will result in a PHP warning.
+
+
+Affected Installations
+======================
+
+Any TYPO3 installation with extended TypoScript constant editor configuration.
+
+
+Migration
+=========
+
+Remove the affected TypoScript constant editor configuration code, and any reference to the removed PHP
+methods and properties.
\ No newline at end of file
index c6ae97a..eb5b45a 100644 (file)
@@ -124,17 +124,11 @@ class ConfigurationUtility implements \TYPO3\CMS\Core\SingletonInterface
         $theConstants = array();
 
         if ((string)$rawConfigurationString !== '') {
-            $extensionPathInformation = $this->getExtensionPathInformation($extensionKey);
-
             /** @var ConfigurationForm $tsStyleConfig */
             $tsStyleConfig = $this->objectManager->get(ConfigurationForm::class);
             $tsStyleConfig->doNotSortCategoriesBeforeMakingForm = true;
 
-            $theConstants = $tsStyleConfig->ext_initTSstyleConfig(
-                $rawConfigurationString,
-                $extensionPathInformation['siteRelPath'],
-                PATH_site . $extensionPathInformation['siteRelPath']
-            );
+            $theConstants = $tsStyleConfig->ext_initTSstyleConfig($rawConfigurationString);
 
             // Loop through configuration items, see if it is assigned to a sub category
             // and add the sub category label to the item property if so.
@@ -165,15 +159,6 @@ class ConfigurationUtility implements \TYPO3\CMS\Core\SingletonInterface
     }
 
     /**
-     * @param string $extensionKey
-     * @return mixed
-     */
-    protected function getExtensionPathInformation($extensionKey)
-    {
-        return $GLOBALS['TYPO3_LOADED_EXT'][$extensionKey];
-    }
-
-    /**
      * Return content of an extensions ext_conf_template.txt file if
      * the file exists, empty string if file does not exist.
      *
index c284b28..df43d5e 100644 (file)
@@ -64,18 +64,13 @@ class ConfigurationUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         /** @var $configurationUtility \TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface|\PHPUnit_Framework_MockObject_MockObject */
         $configurationUtility = $this->getAccessibleMock(
             \TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility::class,
-            array('getDefaultConfigurationRawString', 'getExtensionPathInformation')
+            array('getDefaultConfigurationRawString')
         );
         $configurationUtility
             ->expects($this->once())
             ->method('getDefaultConfigurationRawString')
             ->will($this->returnValue('foo'));
 
-        $configurationUtility
-            ->expects($this->once())
-            ->method('getExtensionPathInformation')
-            ->will($this->returnValue(null));
-
         $tsStyleConfig = $this->getMockBuilder(\TYPO3\CMS\Core\TypoScript\ConfigurationForm::class)->getMock();
 
         $objectManagerMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class)->getMock();
index 92ae023..2e4ce33 100644 (file)
@@ -20,7 +20,6 @@ use TYPO3\CMS\Core\DataHandling\DataHandler;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\TypoScript\ExtendedTemplateService;
-use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Frontend\Page\PageRepository;
 
@@ -49,8 +48,6 @@ class TypoScriptTemplateConstantEditorModuleFunctionController extends AbstractF
         $templateService = GeneralUtility::makeInstance(ExtendedTemplateService::class);
         $GLOBALS['tmpl'] = $templateService;
         $templateService->init();
-        $templateService->ext_localGfxPrefix = ExtensionManagementUtility::extPath('tstemplate');
-        $templateService->ext_localWebGfxPrefix = ExtensionManagementUtility::extRelPath('tstemplate') . 'Resources/Public/';
 
         // Get the row of the first VISIBLE template of the page. whereclause like the frontend.
         $GLOBALS['tplRow'] = $templateService->ext_getFirstTemplate($pageId, $template_uid);
@@ -81,10 +78,9 @@ class TypoScriptTemplateConstantEditorModuleFunctionController extends AbstractF
     public function displayExample($theOutput)
     {
         $templateService = $this->getExtendedTemplateService();
-        if ($templateService->helpConfig['imagetag'] || $templateService->helpConfig['description'] || $templateService->helpConfig['header']) {
+        if ($templateService->helpConfig['description'] || $templateService->helpConfig['header']) {
             $theOutput .= '<div style="padding-top: 30px;"></div>';
             $theOutput .= '<div>' . htmlspecialchars($templateService->helpConfig['header'])
-                . '<div align="center">' . $templateService->helpConfig['imagetag'] . '</div><br>'
                 . ($templateService->helpConfig['description'] ? implode(explode('//', $templateService->helpConfig['description']), '<br>') . '<br>' : '')
                 . ($templateService->helpConfig['bulletlist'] ? '<ul><li>' . implode(explode('//', $templateService->helpConfig['bulletlist']), '<li>') . '</ul>' : '<br>')
                 . '</div>';