use wcf\system\menu\acp\event\AcpMenuCollecting;
use wcf\system\menu\ITreeMenuItem;
use wcf\system\menu\TreeMenu;
+use wcf\system\style\FontAwesomeIcon;
use wcf\system\WCF;
/**
continue;
}
+ $icon = null;
+ if ($item->icon) {
+ if (FontAwesomeIcon::isValidString($item->icon)) {
+ $icon = FontAwesomeIcon::fromString($item->icon);
+ } elseif (\str_starts_with($item->icon, 'fa-')) {
+ // Safeguard to prevent legacy icons from breaking
+ // the admin panel during the upgrade to 6.0.
+ $icon = FontAwesomeIcon::fromString("question;true");
+ }
+ }
+
$this->menuItems[$parentMenuItem][] = new AcpMenuItem(
$item->menuItem,
$item->__toString(),
$item->parentMenuItem,
$item->getLink(),
- $item->icon ?? ''
+ $icon
);
}
}
public readonly string $title = '',
public readonly string $parentMenuItem = '',
public readonly string $link = '',
- public readonly string $icon = ''
+ public readonly ?FontAwesomeIcon $icon = null
) {
}
public function getIcon(): ?FontAwesomeIcon
{
- if ($this->icon) {
- if (FontAwesomeIcon::isValidString($this->icon)) {
- return FontAwesomeIcon::fromString($this->icon);
- } elseif (\str_starts_with($this->icon, 'fa-')) {
- // Safeguard to prevent legacy icons from breaking
- // the admin panel during the upgrade to 6.0.
- return FontAwesomeIcon::fromString("question;true");
- }
- }
-
- return null;
+ return $this->icon;
}
public function __toString()