$components Components keyed by identifier */ public function __construct( private array $components, private SidebarComponentContext $context, ) {} /** * @return array{ * html: string, * modules: list, * accessible: bool, * expanded: bool * } */ public function render(): array { $html = []; $modules = []; foreach ($this->components as $identifier => $component) { $result = $component->getResult($this->context); $html[] = ''; if ($result->module) { $modules[] = $result->module; } } return [ 'html' => $html === [] ? '' : '', 'modules' => $modules, 'accessible' => $this->isAccessible(), 'expanded' => $this->isExpanded(), ]; } public function isAccessible(): bool { return $this->components !== []; } public function isExpanded(): bool { $collapseState = $this->context->user->uc['BackendComponents']['States']['typo3-sidebar']['collapsed'] ?? false; return $collapseState !== true && $collapseState !== 'true'; } public function getComponentByIdentifier(string $identifier): ?SidebarComponentInterface { return $this->components[$identifier] ?? null; } }