TYPO3 CMS  TYPO3_8-7
ModulesController.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
24 
31 {
37  protected $languageService;
38 
44  protected $defaultViewObjectName = BackendTemplateView::class;
45 
50  {
51  parent::__construct();
52  $this->languageService = $languageService ?: $GLOBALS['LANG'];
53  }
54 
60  protected function initializeView(ViewInterface $view)
61  {
63  parent::initializeView($view);
64  // Disable Path
65  $view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation([]);
66  $view->getModuleTemplate()->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/About/EqualHeight');
67  }
68 
72  public function indexAction()
73  {
74  $warnings = [];
75  $securityWarnings = '';
76  // Hook for additional warnings
77  if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['displayWarningMessages'])) {
78  foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['displayWarningMessages'] as $classRef) {
79  $hookObj = GeneralUtility::getUserObj($classRef);
80  if (method_exists($hookObj, 'displayWarningMessages_postProcess')) {
81  $hookObj->displayWarningMessages_postProcess($warnings);
82  }
83  }
84  }
85  if (!empty($warnings)) {
86  if (count($warnings) > 1) {
87  $securityWarnings = '<ul><li>' . implode('</li><li>', $warnings) . '</li></ul>';
88  } else {
89  $securityWarnings = '<p>' . implode('', $warnings) . '</p>';
90  }
91  }
92 
93  $this->view->assignMultiple(
94  [
95  'currentVersion' => TYPO3_version,
96  'copyRightNotice' => BackendUtility::TYPO3_copyRightNotice(),
97  'warningMessages' => $securityWarnings,
98  'warningTitle' => $this->languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:warning.header'),
99  'modules' => $this->getModulesData()
100  ]
101  );
102  }
103 
110  protected function getModulesData()
111  {
113  $loadedModules = GeneralUtility::makeInstance(ModuleLoader::class);
114  $loadedModules->observeWorkspaces = true;
115  $loadedModules->load($GLOBALS['TBE_MODULES']);
116  $mainModulesData = [];
117  foreach ($loadedModules->modules as $moduleName => $moduleInfo) {
118  $moduleLabels = $loadedModules->getLabelsForModule($moduleName);
119  $mainModuleData = [
120  'name' => $moduleName,
121  'label' => $moduleLabels['title']
122  ];
123  if (is_array($moduleInfo['sub']) && !empty($moduleInfo['sub'])) {
124  $mainModuleData['subModules'] = $this->getSubModuleData($loadedModules, $moduleName);
125  }
126  $mainModulesData[] = $mainModuleData;
127  }
128  return $mainModulesData;
129  }
130 
138  protected function getSubModuleData(ModuleLoader $loadedModules, $moduleName)
139  {
140  $subModulesData = [];
141  foreach ($loadedModules->modules[$moduleName]['sub'] as $subModuleName => $subModuleInfo) {
142  $moduleLabels = $loadedModules->getLabelsForModule($moduleName . '_' . $subModuleName);
143  $subModuleData = [];
144  $subModuleData['name'] = $subModuleName;
145  $subModuleData['icon'] = $subModuleInfo['icon'];
146  $subModuleData['iconIdentifier'] = $subModuleInfo['iconIdentifier'];
147  $subModuleData['label'] = $moduleLabels['title'];
148  $subModuleData['shortDescription'] = $moduleLabels['shortdescription'];
149  $subModuleData['longDescription'] = $moduleLabels['description'];
150  $subModulesData[] = $subModuleData;
151  }
152  return $subModulesData;
153  }
154 }
static makeInstance($className,... $constructorArguments)
getSubModuleData(ModuleLoader $loadedModules, $moduleName)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']
__construct(LanguageService $languageService=null)