context->identifier; } public function getType(): string { return $this->context->configuration->getIdentifier(); } public function getTitle(): string { return $this->context->configuration->getTitle(); } public function getDescription(): string { return $this->context->configuration->getDescription(); } public function getIconIdentifier(): string { return $this->context->configuration->getIconIdentifier(); } public function getHeight(): string { return $this->context->configuration->getHeight(); } public function getWidth(): string { return $this->context->configuration->getWidth(); } public function getSettings(): SettingsInterface { return $this->context->settings; } public function getRequest(): ServerRequestInterface { return $this->context->request; } public function getEventData(): array { return ($this->renderer instanceof EventDataInterface) ? $this->renderer->getEventData() : []; } public function getTransferWidgetConfiguration(): TransferWidgetConfiguration { return new TransferWidgetConfiguration( identifier: $this->getIdentifier(), type: $this->getType(), height: $this->getHeight(), width: $this->getWidth(), ); } public function getTransferWidgetData(): TransferWidgetData { $result = $this->render(); return new TransferWidgetData( identifier: $this->getIdentifier(), type: $this->getType(), height: $this->getHeight(), width: $this->getWidth(), label: $result->label ?? $this->getLanguageService()->sL($this->getTitle()), content: $result->content, eventdata: $this->getEventData(), refreshable: $result->refreshable, configurable: ( $this->renderer instanceof WidgetRendererInterface && array_filter($this->renderer->getSettingsDefinitions(), fn($definition) => !$definition->readonly) !== [] ) ); } /** * @return SettingDefinition[] */ public function getSettingsDefinitions(): array { if ($this->renderer instanceof WidgetRendererInterface) { return $this->renderer->getSettingsDefinitions(); } return []; } public function getRawConfig(): array { return $this->context->rawData; } private function render(): WidgetResult { try { if ($this->renderer instanceof WidgetRendererInterface) { return $this->renderer->renderWidget($this->context); } // Map legacy WidgetInterface to "new" WidgetResult return new WidgetResult( content: $this->renderer->renderWidgetContent(), refreshable: $this->renderer->getOptions()['refreshAvailable'] ?? false, ); } catch (\Exception) { return new WidgetResult( content: sprintf('
', $this->getLanguageService()->sL('LLL:EXT:dashboard/Resources/Private/Language/locallang.xlf:widget.error')), refreshable: true, ); } } private function getLanguageService(): LanguageService { return $GLOBALS['LANG']; } }