sCode = $sCode; $this->sLabel = $sLabel; $this->sDescription = $sDescription; $this->aMetaData = $aMetaData; $this->aBadges = $aBadges; $this->sAbout = $sAbout; $this->InitializeToggler(); $this->InitializePopoverMenu(); } public function GetSubBlocks(): array { return [$this->oToggler->GetId() => $this->oToggler, $this->oMoreActions->GetId() => $this->oMoreActions]; } /** * @return string */ public function GetCode(): string { return $this->sCode; } /** * @param string $sCode * * @return ExtensionDetails */ public function SetCode(string $sCode): static { $this->sCode = $sCode; return $this; } /** * @return string */ public function GetLabel(): string { return $this->sLabel; } /** * @param string $sLabel * * @return ExtensionDetails */ public function SetLabel(string $sLabel): static { $this->sLabel = $sLabel; return $this; } /** * @return array */ public function GetMetaData(): array { return $this->aMetaData; } /** * @param array $aMetaData * * @return ExtensionDetails */ public function SetMetaData(array $aMetaData): static { $this->aMetaData = $aMetaData; return $this; } /** * @return string */ public function GetDescription(): string { return $this->sDescription; } /** * @param string $sDescription * * @return ExtensionDetails */ public function SetDescription(string $sDescription): static { $this->sDescription = $sDescription; return $this; } /** * @return Toggler */ public function GetToggler(): Toggler { return $this->oToggler; } /** * @param Toggler $oToggler * * @return ExtensionDetails */ public function SetToggler(Toggler $oToggler): static { $this->oToggler = $oToggler; return $this; } /** * @return array */ public function GetBadges(): array { return $this->aBadges; } /** * @param array $aBadges * * @return ExtensionDetails */ public function SetBadges(array $aBadges): static { $this->aBadges = $aBadges; return $this; } public function AddBadge(Badge $oBadge): static { $this->aBadges[] = $oBadge; return $this; } public function GetMoreActions(): UIContentBlock { return $this->oMoreActions; } protected function InitializeToggler() { $this->oToggler = new Toggler(); $this->oToggler->SetName('ExtensionToggler'); } protected function InitializePopoverMenu() { $sModalLabel = 'About '.$this->sLabel; $sModalText = $this->sAbout; $oModifyButton = new JSButtonItem( 'extension_details', 'More informations', <<oPopoverMenu = new PopoverMenu(); $this->oPopoverMenu->AddItem('more-actions', PopoverMenuItemFactory::MakeFromApplicationPopupMenuItem($oModifyButton)); $oPopoverOpenButton = ButtonUIBlockFactory::MakeIconAction('fas fa-ellipsis-v', 'Show more actions'); $this->oPopoverMenu->SetTogglerFromBlock($oPopoverOpenButton); $this->oMoreActions = new UIContentBlock(); $this->oMoreActions->AddSubBlock($this->oPopoverMenu); $this->oMoreActions->AddSubBlock($oPopoverOpenButton); } public function AllowForceUninstall() { $oForceUninstallButton = new JSButtonItem( 'force_uninstall', 'Force uninstall', <<oPopoverMenu->AddItem('more-actions', PopoverMenuItemFactory::MakeFromApplicationPopupMenuItem($oForceUninstallButton)); } }