‪TYPO3CMS  ‪main
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;
21 use Psr\Http\Message\ServerRequestInterface;
24 
29 {
33  protected ‪$widgets = [];
34 
38  protected ‪$widgetOptions = [];
39 
43  public function ‪__construct(
44  protected readonly string ‪$identifier,
45  protected readonly string $title,
46  protected readonly array $widgetConfig,
47  protected readonly ‪WidgetRegistry $widgetRegistry,
48  protected readonly ContainerInterface $container
49  ) {}
50 
51  public function ‪getIdentifier(): string
52  {
53  return ‪$this->identifier;
54  }
55 
56  public function ‪getTitle(): string
57  {
58  return $this->‪getLanguageService()->sL($this->title) ?: $this->title;
59  }
60 
61  public function ‪getWidgetConfig(): array
62  {
63  return $this->widgetConfig;
64  }
65 
69  public function ‪getWidgets(): array
70  {
71  return ‪$this->widgets;
72  }
73 
78  public function ‪initializeWidgets(ServerRequestInterface $request): void
79  {
80  $availableWidgets = $this->widgetRegistry->getAvailableWidgets();
81  foreach ($this->widgetConfig as $hash => $widgetConfig) {
82  $widgetConfigIdentifier = $widgetConfig['identifier'] ?? '';
83  if ($widgetConfigIdentifier !== '' && array_key_exists($widgetConfigIdentifier, $availableWidgets)) {
84  $this->widgets[$hash] = $availableWidgets[$widgetConfigIdentifier];
85 
86  $widgetObject = $this->widgetRegistry->getAvailableWidget($request, $widgetConfigIdentifier);
87  $this->widgetOptions[$hash] = $widgetObject->getOptions();
88  }
89  }
90  }
91 
92  protected function ‪getLanguageService(): ‪LanguageService
93  {
94  return ‪$GLOBALS['LANG'];
95  }
96 
100  public function ‪getWidgetOptions(): array
101  {
103  }
104 }
‪TYPO3\CMS\Dashboard\Dashboard\getIdentifier
‪getIdentifier()
Definition: Dashboard.php:49
‪TYPO3\CMS\Dashboard\Dashboard\getWidgetConfig
‪getWidgetConfig()
Definition: Dashboard.php:59
‪TYPO3\CMS\Dashboard\Dashboard\initializeWidgets
‪initializeWidgets(ServerRequestInterface $request)
Definition: Dashboard.php:76
‪TYPO3\CMS\Dashboard\Dashboard
Definition: Dashboard.php:29
‪TYPO3\CMS\Dashboard\Dashboard\getLanguageService
‪getLanguageService()
Definition: Dashboard.php:90
‪TYPO3\CMS\Dashboard\WidgetRegistry
Definition: WidgetRegistry.php:33
‪TYPO3\CMS\Dashboard\Dashboard\getWidgetOptions
‪array< string, array > getWidgetOptions()
Definition: Dashboard.php:98
‪TYPO3\CMS\Dashboard\Dashboard\getWidgets
‪array< string, WidgetConfigurationInterface > getWidgets()
Definition: Dashboard.php:67
‪TYPO3\CMS\Dashboard\Dashboard\getTitle
‪getTitle()
Definition: Dashboard.php:54
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Dashboard\Dashboard\$widgets
‪array< string, WidgetConfigurationInterface > $widgets
Definition: Dashboard.php:32
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:46
‪TYPO3\CMS\Dashboard\Widgets\WidgetConfigurationInterface
Definition: WidgetConfigurationInterface.php:26
‪TYPO3\CMS\Dashboard\Dashboard\$widgetOptions
‪array< string, array > $widgetOptions
Definition: Dashboard.php:36
‪TYPO3\CMS\Dashboard
‪TYPO3\CMS\Webhooks\Message\$identifier
‪identifier readonly string $identifier
Definition: FileAddedMessage.php:37
‪TYPO3\CMS\Dashboard\Dashboard\__construct
‪__construct(protected readonly string $identifier, protected readonly string $title, protected readonly array $widgetConfig, protected readonly WidgetRegistry $widgetRegistry, protected readonly ContainerInterface $container)
Definition: Dashboard.php:41