‪TYPO3CMS  10.4
Dashboard.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 
20 use Psr\Container\ContainerInterface;
24 
29 {
33  protected ‪$identifier;
34 
38  protected ‪$title;
39 
43  protected ‪$widgetConfig;
44 
48  protected ‪$widgetRegistry;
49 
53  protected ‪$container;
54 
58  protected ‪$widgets = [];
59 
60  public function ‪__construct(
61  string ‪$identifier,
62  string ‪$title,
63  array ‪$widgetConfig,
65  ContainerInterface ‪$container
66  ) {
67  $this->identifier = ‪$identifier;
68  $this->title = ‪$title;
69  $this->widgetConfig = ‪$widgetConfig;
70  $this->widgetRegistry = ‪$widgetRegistry;
71  $this->container = ‪$container;
72  }
73 
77  public function ‪getIdentifier(): string
78  {
80  }
81 
85  public function ‪getTitle(): string
86  {
87  return $this->‪getLanguageService()->‪sL($this->title) ?: ‪$this->title;
88  }
89 
93  public function ‪getWidgetConfig(): array
94  {
96  }
97 
101  public function ‪getWidgets(): array
102  {
103  return ‪$this->widgets;
104  }
105 
110  public function ‪initializeWidgets(): void
111  {
112  $availableWidgets = $this->widgetRegistry->getAvailableWidgets();
113  foreach ($this->widgetConfig as $hash => ‪$widgetConfig) {
114  /* @var WidgetConfigurationInterface $widgetConfig */
115  if (array_key_exists(‪$widgetConfig['identifier'], $availableWidgets)) {
116  $this->widgets[$hash] = $availableWidgets[‪$widgetConfig['identifier']];
117  }
118  }
119  }
120 
124  protected function ‪getLanguageService(): LanguageService
125  {
126  return ‪$GLOBALS['LANG'];
127  }
128 }
‪TYPO3\CMS\Dashboard\Dashboard\$title
‪string $title
Definition: Dashboard.php:36
‪TYPO3\CMS\Dashboard\Dashboard\$widgets
‪WidgetInterface[] $widgets
Definition: Dashboard.php:52
‪TYPO3\CMS\Dashboard\Dashboard\$identifier
‪string $identifier
Definition: Dashboard.php:32
‪TYPO3\CMS\Dashboard\Dashboard\getLanguageService
‪LanguageService getLanguageService()
Definition: Dashboard.php:118
‪TYPO3\CMS\Dashboard\Dashboard\getWidgets
‪WidgetInterface[] getWidgets()
Definition: Dashboard.php:95
‪TYPO3\CMS\Dashboard\Widgets\WidgetInterface
Definition: WidgetInterface.php:26
‪TYPO3\CMS\Dashboard\Dashboard
Definition: Dashboard.php:29
‪TYPO3\CMS\Core\Localization\LanguageService\sL
‪string sL($input)
Definition: LanguageService.php:194
‪TYPO3\CMS\Dashboard\Dashboard\initializeWidgets
‪initializeWidgets()
Definition: Dashboard.php:104
‪TYPO3\CMS\Dashboard\Dashboard\__construct
‪__construct(string $identifier, string $title, array $widgetConfig, WidgetRegistry $widgetRegistry, ContainerInterface $container)
Definition: Dashboard.php:54
‪TYPO3\CMS\Dashboard\WidgetRegistry
Definition: WidgetRegistry.php:31
‪TYPO3\CMS\Dashboard\Dashboard\getIdentifier
‪string getIdentifier()
Definition: Dashboard.php:71
‪TYPO3\CMS\Dashboard\Dashboard\getWidgetConfig
‪array getWidgetConfig()
Definition: Dashboard.php:87
‪TYPO3\CMS\Dashboard\Dashboard\$container
‪ContainerInterface $container
Definition: Dashboard.php:48
‪TYPO3\CMS\Dashboard\Dashboard\$widgetConfig
‪array $widgetConfig
Definition: Dashboard.php:40
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Dashboard\Dashboard\getTitle
‪string getTitle()
Definition: Dashboard.php:79
‪TYPO3\CMS\Dashboard\Dashboard\$widgetRegistry
‪WidgetRegistry $widgetRegistry
Definition: Dashboard.php:44
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:42
‪TYPO3\CMS\Dashboard\Widgets\WidgetConfigurationInterface
Definition: WidgetConfigurationInterface.php:26
‪TYPO3\CMS\Dashboard