[BUGFIX] Implement wrapper for array_column function 99/34299/4
authorMarkus Klein <klein.t3@reelworx.at>
Tue, 18 Nov 2014 09:33:10 +0000 (10:33 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Tue, 18 Nov 2014 11:41:11 +0000 (12:41 +0100)
This fixes a regression from #42457.
The function array_column is not available on PHP versions below 5.5,
hence we have to simulate it.

The handcrafted implementation stems from the PHP comments posted
with the original function.

Resolves: #63042
Related: #42457
Releases: 6.2
Change-Id: I7edb072cbee7309883c5582386b9de1caf37be06
Reviewed-on: http://review.typo3.org/34299
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
typo3/sysext/backend/Classes/Controller/ContentElement/NewContentElementController.php

index 32d1fe2..6c980c5 100644 (file)
@@ -262,9 +262,9 @@ class NewContentElementController {
 
                                // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable:
                                $colPosArray = GeneralUtility::callUserFunction('TYPO3\\CMS\\Backend\\View\\BackendLayoutView->getColPosListItemsParsed', $this->id, $this);
-                               $colPosIds = array_column($colPosArray, 1);
+                               $colPosIds = array_map(function($element){ return (int)$element[1]; }, $colPosArray);
                                // Removing duplicates, if any
-                               $colPosList = implode(',', array_unique(array_map('intval', $colPosIds)));
+                               $colPosList = implode(',', array_unique($colPosIds));
                                // Finally, add the content of the column selector to the content:
                                $code .= $posMap->printContentElementColumns($this->id, 0, $colPosList, 1, $this->R_URI);
                                $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('2_selectPosition'), $code, 0, 1);