Skip to content
Snippets Groups Projects
Commit ea435026 authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Refactoring category getter

parent 786bd36a
No related branches found
No related tags found
1 merge request!2Feature be module
......@@ -42,6 +42,7 @@ use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
*/
class Utility {
const CATEGORY_DOKTYPE = 117;
const NEWS_DOKTYPE = 117;
/**
* create buttons for the backend module header
......@@ -101,7 +102,7 @@ class Utility {
}
/**
* Get an array of all category titles below the given site root id
* Get an array of all category uids => >titles below the given site root id
*
* @param $siteRootPid
* @throws \InvalidArgumentException
......@@ -117,11 +118,13 @@ class Utility {
$databaseConnection = $GLOBALS['TYPO3_DB'];
$where = 'doktype = ' . self::CATEGORY_DOKTYPE . ' AND uid in (' . $childPids . ')';
$result = $databaseConnection->exec_SELECTquery('title', 'pages', $where)->fetch_all();
$result = $databaseConnection->exec_SELECTquery('uid, title', 'pages', $where)->fetch_all();
$categories = [];
foreach($result as $item) {
$categories[] = $item[0];
/** @var array $result */
foreach ($result as $item) {
$categories[$item[0]] = $item[1];
}
return $categories;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment