[TASK] Remove leftover "menu_type" occurrences 85/62785/2
authorBenni Mack <benni@typo3.org>
Mon, 30 Dec 2019 08:46:16 +0000 (09:46 +0100)
committerBenni Mack <benni@typo3.org>
Mon, 30 Dec 2019 11:28:21 +0000 (12:28 +0100)
With TYPO3 v8.6, the new Content Types for menus were introduced
where each menu type is not stored in the database field "menu_type"
anymore, but moved to a separate "CType" property. This change
was breaking, however some left-over code was there but never
removed. The code does not do anything anymore but handle the
special "menu_type" cases like in Page Module CType Previews
or categorization handling.

FYI: This is a pre-patch to streamline the category API.

Resolves: #90035
Releases: master
Change-Id: I180fc5b1e2d33f74cf05d2565ab11049cc361c49
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62785
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Benjamin Kott <benjamin.kott@outlook.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Benjamin Kott <benjamin.kott@outlook.com>
Reviewed-by: Benni Mack <benni@typo3.org>
typo3/sysext/backend/Classes/View/PageLayoutView.php
typo3/sysext/core/Classes/Category/CategoryRegistry.php
typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php
typo3/sysext/frontend/Resources/Private/Language/locallang_csh_ttcontent.xlf
typo3/sysext/frontend/Resources/Private/Language/locallang_ttc.xlf
typo3/sysext/t3editor/Resources/Public/JavaScript/Mode/typoscript/typoscript.js

index 09e5e42..c2630e6 100644 (file)
@@ -2216,20 +2216,6 @@ class PageLayoutView implements LoggerAwareInterface
                         $out .= $this->linkEditContent($this->getThumbCodeUnlinked($row, 'tt_content', 'media'), $row) . '<br />';
                     }
                     break;
-                case 'menu':
-                    $contentType = $this->CType_labels[$row['CType']];
-                    $out .= $this->linkEditContent('<strong>' . htmlspecialchars($contentType) . '</strong>', $row) . '<br />';
-                    // Add Menu Type
-                    $menuTypeLabel = $this->getLanguageService()->sL(
-                        BackendUtility::getLabelFromItemListMerged($row['pid'], 'tt_content', 'menu_type', $row['menu_type'])
-                    );
-                    $menuTypeLabel = $menuTypeLabel ?: 'invalid menu type';
-                    $out .= $this->linkEditContent($menuTypeLabel, $row);
-                    if ($row['menu_type'] !== '2' && ($row['pages'] || $row['selected_categories'])) {
-                        // Show pages if menu type is not "Sitemap"
-                        $out .= ':' . $this->linkEditContent($this->generateListForCTypeMenu($row), $row) . '<br />';
-                    }
-                    break;
                 case 'shortcut':
                     if (!empty($row['records'])) {
                         $shortcutContent = [];
@@ -2315,34 +2301,6 @@ class PageLayoutView implements LoggerAwareInterface
     }
 
     /**
-     * Generates a list of selected pages or categories for the CType menu
-     *
-     * @param array $row row from pages
-     * @return string
-     */
-    protected function generateListForCTypeMenu(array $row)
-    {
-        $table = 'pages';
-        $field = 'pages';
-        // get categories instead of pages
-        if (strpos($row['menu_type'], 'categorized_') !== false) {
-            $table = 'sys_category';
-            $field = 'selected_categories';
-        }
-        if (trim($row[$field]) === '') {
-            return '';
-        }
-        $content = '';
-        $uidList = explode(',', $row[$field]);
-        foreach ($uidList as $uid) {
-            $uid = (int)$uid;
-            $record = BackendUtility::getRecord($table, $uid, 'title');
-            $content .= '<br>' . $record['title'] . ' (' . $uid . ')';
-        }
-        return $content;
-    }
-
-    /**
      * Filters out all tt_content uids which are already translated so only non-translated uids is left.
      * Selects across columns, but within in the same PID. Columns are expect to be the same
      * for translations and original but this may be a conceptual error (?)
index 8227936..3d2f140 100644 (file)
@@ -145,19 +145,9 @@ class CategoryRegistry implements SingletonInterface
     public function getCategoryFieldsForTable(array &$configuration)
     {
         $table = $configuration['config']['itemsProcConfig']['table'] ?? '';
-        // Lookup table for legacy menu content element
-        if (empty($table)) {
-            $menuType = $configuration['row']['menu_type'][0] ?? '';
-            // Define the table being looked up from the type of menu
-            if ($menuType === 'categorized_pages') {
-                $table = 'pages';
-            } elseif ($menuType === 'categorized_content') {
-                $table = 'tt_content';
-            }
-        }
         // Return early if no table is defined
         if (empty($table)) {
-            throw new \UnexpectedValueException('The given menu_type is not supported.', 1381823570);
+            throw new \UnexpectedValueException('No table is given.', 1381823570);
         }
         // Loop on all registries and find entries for the correct table
         foreach ($this->registry as $tableName => $fields) {
index 389bc90..70057e6 100644 (file)
@@ -1203,7 +1203,6 @@ class ExtensionManagementUtility
      *
      * $type determines the type of frontend plugin:
      * + list_type (default) - the good old "Insert plugin" entry
-     * + menu_type - a "Menu/Sitemap" entry
      * + CType - a new content element type
      * + header_layout - an additional header type (added to the selection of layout1-5)
      * + includeLib - just includes the library for manual use somewhere in TypoScript.
@@ -1232,9 +1231,6 @@ plugin.' . $cN . $suffix . '.userFunc = ' . $cN . $suffix . '->main
             case 'list_type':
                 $addLine = 'tt_content.list.20.' . $key . $suffix . ' = < plugin.' . $cN . $suffix;
                 break;
-            case 'menu_type':
-                $addLine = 'tt_content.menu.20.' . $key . $suffix . ' = < plugin.' . $cN . $suffix;
-                break;
             case 'CType':
                 $addLine = trim('
 tt_content.' . $key . $suffix . ' =< lib.contentElement
index 716e45b..3905044 100644 (file)
@@ -479,10 +479,6 @@ tt_content:sectionIndex</source>
                        <trans-unit id="sectionIndex.details" resname="sectionIndex.details">
                                <source>See more details about Section Menus by clicking below.</source>
                        </trans-unit>
-                       <trans-unit id="_sectionIndex.seeAlso" resname="_sectionIndex.seeAlso">
-                               <source>tt_content:menu_type</source>
-                               <note from="developer">This string contains an internal text, which must not be changed. Just copy the original text into the translation field. For more information have a look at the Tutorial.</note>
-                       </trans-unit>
                        <trans-unit id="linkToTop.description" resname="linkToTop.description">
                                <source>If checked, a small  "To Top" link will be added after the Content Element, linking back to the top of the page.</source>
                        </trans-unit>
index 31c65f5..e803679 100644 (file)
                        <trans-unit id="recursive.I.5" resname="recursive.I.5">
                                <source>Infinite</source>
                        </trans-unit>
-                       <trans-unit id="menu_type" resname="menu_type">
-                               <source>Menu Type</source>
-                       </trans-unit>
-                       <trans-unit id="menu_type_formlabel" resname="menu_type_formlabel">
-                               <source>Menu Type</source>
-                       </trans-unit>
-                       <trans-unit id="menu_type.I.0" resname="menu_type.I.0">
-                               <source>Menu of selected pages</source>
-                       </trans-unit>
-                       <trans-unit id="menu_type.I.1" resname="menu_type.I.1">
-                               <source>Menu of subpages of selected pages</source>
-                       </trans-unit>
-                       <trans-unit id="menu_type.I.2" resname="menu_type.I.2">
-                               <source>Menu of subpages of selected pages including abstracts</source>
-                       </trans-unit>
-                       <trans-unit id="menu_type.I.3" resname="menu_type.I.3">
-                               <source>Menu of subpages of selected pages including sections</source>
-                       </trans-unit>
-                       <trans-unit id="menu_type.I.4" resname="menu_type.I.4">
-                               <source>Sitemap</source>
-                       </trans-unit>
-                       <trans-unit id="menu_type.I.5" resname="menu_type.I.5">
-                               <source>Section index (page content marked for section menus)</source>
-                       </trans-unit>
-                       <trans-unit id="menu_type.I.6" resname="menu_type.I.6">
-                               <source>Recently updated pages</source>
-                       </trans-unit>
-                       <trans-unit id="menu_type.I.7" resname="menu_type.I.7">
-                               <source>Related pages (based on keywords)</source>
-                       </trans-unit>
-                       <trans-unit id="menu_type.I.8" resname="menu_type.I.8">
-                               <source>Sitemaps of selected pages</source>
-                       </trans-unit>
-                       <trans-unit id="menu_type.I.categorized_pages" resname="menu_type.I.categorized_pages">
-                               <source>Pages for selected categories</source>
-                       </trans-unit>
-                       <trans-unit id="menu_type.I.categorized_content" resname="menu_type.I.categorized_content">
-                               <source>Content elements for selected categories</source>
-                       </trans-unit>
                        <trans-unit id="list_type" resname="list_type">
                                <source>Plugin</source>
                        </trans-unit>
index d931612..2ea1e1d 100644 (file)
         'maxWInText': kw('maxWInText'),
         'media': B,
         'menu': B,
-        'menu_type': kw('menu_type'),
         'menuHeight': kw('menuHeight'),
         'menuName': kw('menuName'),
         'menuOffset': kw('menuOffset'),