‪TYPO3CMS  10.4
WidgetGroupInitializationService.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
18 namespace ‪TYPO3\CMS\Dashboard;
19 
21 
26 {
31 
36 
38  {
39  $this->widgetGroupRegistry = ‪$widgetGroupRegistry;
40  $this->widgetRegistry = ‪$widgetRegistry;
41  }
42 
48  public function ‪buildWidgetGroupsConfiguration(): array
49  {
50  $groupConfigurations = [];
51  foreach ($this->widgetGroupRegistry->getWidgetGroups() as $widgetGroup) {
52  $widgets = [];
53  $widgetGroupIdentifier = $widgetGroup->getIdentifier();
54 
55  $widgetsForGroup = $this->widgetRegistry->getAvailableWidgetsForWidgetGroup($widgetGroupIdentifier);
56  foreach ($widgetsForGroup as $widgetConfiguration) {
57  $widgets[$widgetConfiguration->getIdentifier()] = [
58  'iconIdentifier' => $widgetConfiguration->getIconIdentifier(),
59  'title' => $this->‪getLanguageService()->sL($widgetConfiguration->getTitle()),
60  'description' => $this->‪getLanguageService()->sL($widgetConfiguration->getDescription()),
61  ];
62  }
63 
64  $groupConfigurations[$widgetGroupIdentifier] = [
65  'identifier' => $widgetGroupIdentifier,
66  'title' => $widgetGroup->getTitle(),
67  'widgets' => $widgets,
68  ];
69  }
70 
71  return $groupConfigurations;
72  }
73 
74  protected function ‪getLanguageService(): ‪LanguageService
75  {
76  return ‪$GLOBALS['LANG'];
77  }
78 }
‪TYPO3\CMS\Dashboard\WidgetGroupInitializationService\$widgetRegistry
‪WidgetRegistry $widgetRegistry
Definition: WidgetGroupInitializationService.php:33
‪TYPO3\CMS\Dashboard\WidgetGroupRegistry
Definition: WidgetGroupRegistry.php:26
‪TYPO3\CMS\Dashboard\WidgetRegistry
Definition: WidgetRegistry.php:31
‪TYPO3\CMS\Dashboard\WidgetGroupInitializationService\__construct
‪__construct(WidgetGroupRegistry $widgetGroupRegistry, WidgetRegistry $widgetRegistry)
Definition: WidgetGroupInitializationService.php:35
‪TYPO3\CMS\Dashboard\WidgetGroupInitializationService\$widgetGroupRegistry
‪WidgetGroupRegistry $widgetGroupRegistry
Definition: WidgetGroupInitializationService.php:29
‪TYPO3\CMS\Dashboard\WidgetGroupInitializationService\buildWidgetGroupsConfiguration
‪array buildWidgetGroupsConfiguration()
Definition: WidgetGroupInitializationService.php:46
‪TYPO3\CMS\Dashboard\WidgetGroupInitializationService
Definition: WidgetGroupInitializationService.php:26
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:42
‪TYPO3\CMS\Dashboard\WidgetGroupInitializationService\getLanguageService
‪getLanguageService()
Definition: WidgetGroupInitializationService.php:72
‪TYPO3\CMS\Dashboard