[!!!][TASK] Remove deprecated TMENU options 91/59291/2
authorBenni Mack <benni@typo3.org>
Mon, 24 Dec 2018 18:52:33 +0000 (19:52 +0100)
committerGeorg Ringer <georg.ringer@gmail.com>
Fri, 28 Dec 2018 07:43:49 +0000 (08:43 +0100)
The TMENU options beforeImg and afterImg have been removed as
well, as part of removal of image generation being part of the
menu generation.

Resolves: #87287
Releases: master
Change-Id: I81134ccf3c8af9368ff0521e7b136d457333903e
Reviewed-on: https://review.typo3.org/59291
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/core/Documentation/Changelog/master/Breaking-87193-DeprecatedFunctionalityRemoved.rst
typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php
typo3/sysext/frontend/Classes/ContentObject/Menu/TextMenuContentObject.php

index 7312b3e..291314b 100644 (file)
@@ -468,6 +468,10 @@ The following public class properties have been dropped:
 * :php:`TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->workspacePreview`
 * :php:`TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject->debug`
 * :php:`TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject->GMENU_fixKey`
+* :php:`TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject->imgNameNotRandom`
+* :php:`TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject->imgNamePrefix`
+* :php:`TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject->INPfixMD5`
+* :php:`TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject->nameAttribute`
 * :php:`TYPO3C\MS\Frontend\ContentObject\Menu\AbstractMenuContentObject->WMfreezePrefix`
 * :php:`TYPO3\CMS\Frontend\Page\PageRepository->error_getRootLine_failPid`
 * :php:`TYPO3\CMS\Frontend\Page\PageRepository->error_getRootLine`
@@ -760,13 +764,9 @@ The following class properties have changed visibility:
 * :php:`TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject->hash` changed from public to protected
 * :php:`TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject->id` changed from public to protected
 * :php:`TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject->I` changed from public to protected
-* :php:`TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject->imgNameNotRandom` changed from public to protected
-* :php:`TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject->imgNamePrefix` changed from public to protected
-* :php:`TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject->INPfixMD5` changed from public to protected
 * :php:`TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject->mconf` changed from public to protected
 * :php:`TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject->menuArr` changed from public to protected
 * :php:`TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject->menuNumber` changed from public to protected
-* :php:`TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject->nameAttribute` changed from public to protected
 * :php:`TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject->nextActive` changed from public to protected
 * :php:`TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject->MP_array` changed from public to protected
 * :php:`TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject->result` changed from public to protected
@@ -862,6 +862,8 @@ The following TypoScript options have been dropped:
 * `stdWrap.addParams`
 * `stdWrap.filelink`
 * `stdWrap.filelist`
+* `TMENU.beforeImg`
+* `TMENU.afterImg`
 * `GMENU`
 * `GMENUITEMS`
 * `IMGMENU`
index edd1cfd..b511c13 100644 (file)
@@ -75,16 +75,6 @@ abstract class AbstractMenuContentObject
     protected $alwaysActivePIDlist = [];
 
     /**
-     * @var string
-     */
-    protected $imgNamePrefix = 'img';
-
-    /**
-     * @var int
-     */
-    protected $imgNameNotRandom = 0;
-
-    /**
      * Loaded with the parent cObj-object when a new HMENU is made
      *
      * @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
@@ -163,11 +153,6 @@ abstract class AbstractMenuContentObject
     protected $rL_uidRegister;
 
     /**
-     * @var string
-     */
-    protected $INPfixMD5;
-
-    /**
      * @var mixed[]
      */
     protected $I;
@@ -205,13 +190,6 @@ abstract class AbstractMenuContentObject
     protected $alternativeMenuTempArray = '';
 
     /**
-     * Will be 'id' in XHTML-mode
-     *
-     * @var string
-     */
-    protected $nameAttribute = 'name';
-
-    /**
      * TRUE to use cHash in generated link (normally only for the language
      * selector and if parameters exist in the URL).
      *
@@ -251,21 +229,6 @@ abstract class AbstractMenuContentObject
         $this->menuNumber = $menuNumber;
         $this->mconf = $conf[$this->menuNumber . $objSuffix . '.'];
         $this->WMcObj = GeneralUtility::makeInstance(ContentObjectRenderer::class);
-        // In XHTML and HTML5 there is no "name" attribute anymore
-        switch ($tsfe->xhtmlDoctype) {
-            case 'xhtml_strict':
-                // intended fall-through
-            case 'xhtml_11':
-                // intended fall-through
-            case 'html5':
-                // intended fall-through
-            case '':
-                // empty means that it's HTML5 by default
-                $this->nameAttribute = 'id';
-                break;
-            default:
-                $this->nameAttribute = 'name';
-        }
         // Sets the internal vars. $tmpl MUST be the template-object. $sys_page MUST be the sys_page object
         if ($this->conf[$this->menuNumber . $objSuffix] && is_object($tmpl) && is_object($sys_page)) {
             $this->tmpl = $tmpl;
@@ -390,17 +353,10 @@ abstract class AbstractMenuContentObject
             } else {
                 $this->nextActive = '';
             }
-            // imgNamePrefix
-            if ($this->mconf['imgNamePrefix']) {
-                $this->imgNamePrefix = $this->mconf['imgNamePrefix'];
-            }
-            $this->imgNameNotRandom = $this->mconf['imgNameNotRandom'];
-            $retVal = true;
-        } else {
-            $this->getTimeTracker()->setTSlogMessage('ERROR in menu', 3);
-            $retVal = false;
+            return true;
         }
-        return $retVal;
+        $this->getTimeTracker()->setTSlogMessage('ERROR in menu', 3);
+        return false;
     }
 
     /**
index e14dfaa..23a0fa8 100644 (file)
@@ -58,7 +58,6 @@ class TextMenuContentObject extends AbstractMenuContentObject
         }
 
         $this->WMresult = '';
-        $this->INPfixMD5 = substr(md5(microtime() . 'tmenu'), 0, 4);
         $this->WMmenuItems = count($this->result);
         $typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class);
         $this->WMsubmenuObjSuffixes = $typoScriptService->explodeConfigurationForOptionSplit(['sOSuffix' => $this->mconf['submenuObjSuffixes']], $this->WMmenuItems);
@@ -69,7 +68,6 @@ class TextMenuContentObject extends AbstractMenuContentObject
             $this->WMcObj->start($this->menuArr[$key], 'pages');
             $this->I = [];
             $this->I['key'] = $key;
-            $this->I['INPfix'] = ($this->imgNameNotRandom ? '' : '_' . $this->INPfixMD5) . '_' . $key;
             $this->I['val'] = $val;
             $this->I['title'] = isset($this->I['val']['stdWrap.']) ? $this->WMcObj->stdWrap($this->getPageTitle($this->menuArr[$key]['title'], $this->menuArr[$key]['nav_title']), $this->I['val']['stdWrap.']) : $this->getPageTitle($this->menuArr[$key]['title'], $this->menuArr[$key]['nav_title']);
             $this->I['uid'] = $this->menuArr[$key]['uid'];
@@ -167,33 +165,23 @@ class TextMenuContentObject extends AbstractMenuContentObject
     }
 
     /**
-     * Generates the before* and after* images for TMENUs
+     * Generates the before* and after* stdWrap for TMENUs
+     * Evaluates:
+     * - before.stdWrap*
+     * - beforeWrap
+     * - after.stdWrap*
+     * - afterWrap
      *
-     * @param string $pref Can be "before" or "after" and determines which kind of image to create (basically this is the prefix of the TypoScript properties that are read from the ->I['val'] array
-     * @return string The resulting HTML of the image, if any.
+     * @param string $pref Can be "before" or "after" and determines which kind of stdWrap to process (basically this is the prefix of the TypoScript properties that are read from the ->I['val'] array
+     * @return string The resulting HTML
      */
     protected function getBeforeAfter($pref)
     {
-        $res = '';
-        if ($imgInfo = $this->WMcObj->getImgResource($this->I['val'][$pref . 'Img'], $this->I['val'][$pref . 'Img.'])) {
-            $theName = $this->imgNamePrefix . $this->I['uid'] . $this->I['INPfix'] . $pref;
-            $name = ' ' . $this->nameAttribute . '="' . $theName . '"';
-            $GLOBALS['TSFE']->imagesOnPage[] = $imgInfo[3];
-            $res = '<img' . ' src="' . $GLOBALS['TSFE']->absRefPrefix . $imgInfo[3] . '"' . ' width="' . $imgInfo[0] . '"' . ' height="' . $imgInfo[1] . '"' . $name . ($this->I['val'][$pref . 'ImgTagParams'] ? ' ' . $this->I['val'][$pref . 'ImgTagParams'] : '') . $this->parent_cObj->getBorderAttr(' border="0"');
-            if (!strstr($res, 'alt="')) {
-                // Adding alt attribute if not set.
-                $res .= ' alt=""';
-            }
-            $res .= ' />';
-            if ($this->I['val'][$pref . 'ImgLink']) {
-                $res = $this->I['A1'] . $res . $this->I['A2'];
-            }
-        }
         $processedPref = isset($this->I['val'][$pref . '.']) ? $this->WMcObj->stdWrap($this->I['val'][$pref], $this->I['val'][$pref . '.']) : $this->I['val'][$pref];
         if (isset($this->I['val'][$pref . 'Wrap'])) {
-            return $this->WMcObj->wrap($res . $processedPref, $this->I['val'][$pref . 'Wrap']);
+            return $this->WMcObj->wrap($processedPref, $this->I['val'][$pref . 'Wrap']);
         }
-        return $res . $processedPref;
+        return $processedPref;
     }
 
     /**