[TASK] Migrate leftover userfunc for tt_content to hook class 44/34244/2
authorBenjamin Mack <benni@typo3.org>
Sun, 16 Nov 2014 11:55:51 +0000 (12:55 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Sun, 23 Nov 2014 22:12:22 +0000 (23:12 +0100)
One method still initialized on every uncached call
is user_sortPluginList() which is used in TCA tt_content
to sort all plugins by name (trivial, right?).

The patch moves the code in the right direction.

Releases: master
Resolves: #63006
Change-Id: I9be865ee3429e033a924b00d0e1b98ad4159c15e
Reviewed-on: http://review.typo3.org/34244
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Reviewed-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Tested-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/cms/ext_tables.php
typo3/sysext/frontend/Classes/Hooks/TableColumnHooks.php [new file with mode: 0644]
typo3/sysext/frontend/Configuration/TCA/tt_content.php

index 1a126e3..1860057 100644 (file)
@@ -19,15 +19,4 @@ if (TYPO3_MODE === 'BE') {
        );
 }
 // Add allowed records to pages:
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('pages_language_overlay,tt_content,sys_template,sys_domain,backend_layout');
-
-if (!function_exists('user_sortPluginList')) {
-       function user_sortPluginList(array &$parameters) {
-               usort(
-                       $parameters['items'],
-                       function ($item1, $item2) {
-                               return strcasecmp($GLOBALS['LANG']->sL($item1[0]), $GLOBALS['LANG']->sL($item2[0]));
-                       }
-               );
-       }
-}
\ No newline at end of file
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('pages_language_overlay,tt_content,sys_template,sys_domain,backend_layout');
\ No newline at end of file
diff --git a/typo3/sysext/frontend/Classes/Hooks/TableColumnHooks.php b/typo3/sysext/frontend/Classes/Hooks/TableColumnHooks.php
new file mode 100644 (file)
index 0000000..2746b90
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+namespace TYPO3\CMS\Frontend\Hooks;
+
+/**
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * Hooks / manipulation data for TCA columns e.g. to sort items within itemsProcFunc
+ */
+class TableColumnHooks {
+
+       /**
+        * sort list items (used for plugins, list_type) by name
+        * @param array $parameters
+        */
+       public function sortPluginList(array &$parameters) {
+               usort(
+                       $parameters['items'],
+                       function ($item1, $item2) {
+                               return strcasecmp($GLOBALS['LANG']->sL($item1[0]), $GLOBALS['LANG']->sL($item2[0]));
+                       }
+               );
+       }
+}
\ No newline at end of file
index 0281b80..da0af85 100644 (file)
@@ -1189,7 +1189,7 @@ return array(
                                                ''
                                        )
                                ),
-                               'itemsProcFunc' => 'user_sortPluginList',
+                               'itemsProcFunc' => 'TYPO3\\CMS\\Frontend\\Hooks\\TableColumnHooks->sortPluginList',
                                'default' => '',
                                'authMode' => $GLOBALS['TYPO3_CONF_VARS']['BE']['explicitADmode'],
                                'iconsInOptionTags' => 1,