From: Matthias Schmidt Date: Sun, 24 Jun 2018 07:21:28 +0000 (+0200) Subject: Use new icon form field X-Git-Tag: 5.2.0_Alpha_1~715 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e8a040e13b0499394b49a800fde4ab60cedac52d;p=GitHub%2FWoltLab%2FWCF.git Use new icon form field See 30f8e4944508c746db1c198c139f3eced498659c See #2545 --- diff --git a/wcfsetup/install/files/lib/data/acp/menu/item/ACPMenuItemEditor.class.php b/wcfsetup/install/files/lib/data/acp/menu/item/ACPMenuItemEditor.class.php index 4ab9c87b1b..974376cbd9 100644 --- a/wcfsetup/install/files/lib/data/acp/menu/item/ACPMenuItemEditor.class.php +++ b/wcfsetup/install/files/lib/data/acp/menu/item/ACPMenuItemEditor.class.php @@ -2,6 +2,8 @@ declare(strict_types=1); namespace wcf\data\acp\menu\item; use wcf\data\DatabaseObjectEditor; +use wcf\data\IEditableCachedObject; +use wcf\system\cache\builder\ACPMenuCacheBuilder; /** * Provides functions to edit ACP menu items. @@ -15,9 +17,16 @@ use wcf\data\DatabaseObjectEditor; * @method ACPMenuItem getDecoratedObject() * @mixin ACPMenuItem */ -class ACPMenuItemEditor extends DatabaseObjectEditor { +class ACPMenuItemEditor extends DatabaseObjectEditor implements IEditableCachedObject { /** * @inheritDoc */ protected static $baseClass = ACPMenuItem::class; + + /** + * @inheritDoc + */ + public static function resetCache() { + ACPMenuCacheBuilder::getInstance()->reset(); + } } diff --git a/wcfsetup/install/files/lib/system/package/plugin/ACPMenuPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/ACPMenuPackageInstallationPlugin.class.php index 7a3446be77..cdfc2526d9 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/ACPMenuPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/ACPMenuPackageInstallationPlugin.class.php @@ -5,6 +5,7 @@ use wcf\data\acp\menu\item\ACPMenuItemEditor; use wcf\system\devtools\pip\IGuiPackageInstallationPlugin; use wcf\system\form\builder\container\IFormContainer; use wcf\system\form\builder\field\dependency\ValueFormFieldDependency; +use wcf\system\form\builder\field\IconFormField; use wcf\system\form\builder\field\SingleSelectionFormField; use wcf\system\form\builder\field\TextFormField; use wcf\system\form\builder\field\validation\FormFieldValidationError; @@ -12,7 +13,6 @@ use wcf\system\form\builder\field\validation\FormFieldValidator; use wcf\system\form\builder\field\validation\FormFieldValidatorUtil; use wcf\system\form\builder\field\validation\RegularExpressionFormFieldValidator; use wcf\system\form\builder\IFormDocument; -use wcf\system\style\StyleHandler; /** * Installs, updates and deletes ACP menu items. @@ -71,19 +71,10 @@ class ACPMenuPackageInstallationPlugin extends AbstractMenuPackageInstallationPl return $value === 0 || $value == 3; })); - // TODO: if an `IconFormField` class should be added, use that class instead - $dataContainer->appendChild(SingleSelectionFormField::create('icon') + $dataContainer->appendChild(IconFormField::create('icon') ->label('wcf.acp.pip.acpMenu.icon') ->description('wcf.acp.pip.acpMenu.icon.description') - ->filterable() ->required() - ->options(function(): array { - $icons = array_map(function(string $icon): string { - return 'fa-' . $icon; - }, StyleHandler::getInstance()->getIcons()); - - return array_combine($icons, $icons); - }) ->addDependency( ValueFormFieldDependency::create('parentMenuItem') ->field($parentMenuItemFormField) diff --git a/wcfsetup/install/files/lib/system/package/plugin/UserMenuPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/UserMenuPackageInstallationPlugin.class.php index cab1927826..7a25cba247 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/UserMenuPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/UserMenuPackageInstallationPlugin.class.php @@ -6,12 +6,12 @@ use wcf\system\devtools\pip\IGuiPackageInstallationPlugin; use wcf\system\form\builder\container\IFormContainer; use wcf\system\form\builder\field\ClassNameFormField; use wcf\system\form\builder\field\dependency\ValueFormFieldDependency; +use wcf\system\form\builder\field\IconFormField; use wcf\system\form\builder\field\SingleSelectionFormField; use wcf\system\form\builder\field\TextFormField; use wcf\system\form\builder\field\validation\FormFieldValidatorUtil; use wcf\system\form\builder\IFormDocument; use wcf\system\menu\user\IUserMenuItemProvider; -use wcf\system\style\StyleHandler; /** * Installs, updates and deletes user menu items. @@ -77,20 +77,11 @@ class UserMenuPackageInstallationPlugin extends AbstractMenuPackageInstallationP /** @var SingleSelectionFormField $parentMenuItemFormField */ $parentMenuItemFormField = $form->getNodeById('parentMenuItem'); - // TODO: if an `IconFormField` class should be added, use that class instead - $dataContainer->appendChild(SingleSelectionFormField::create('iconClassName') + $dataContainer->appendChild(IconFormField::create('iconClassName') ->objectProperty('iconclassname') ->label('wcf.acp.pip.userMenu.iconClassName') ->description('wcf.acp.pip.userMenu.iconClassName.description') - ->filterable() ->required() - ->options(function(): array { - $icons = array_map(function(string $icon): string { - return 'fa-' . $icon; - }, StyleHandler::getInstance()->getIcons()); - - return array_combine($icons, $icons); - }) ->addDependency( // only first level menu items support icons ValueFormFieldDependency::create('parentMenuItem')