From f781462d8a3aa6f5f2181701cc9e6d4a4777213c Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Tue, 10 Dec 2024 17:24:27 +0100 Subject: [PATCH] Add option to invert the logic in toggle action --- .../files/lib/system/gridView/action/ToggleAction.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/gridView/action/ToggleAction.class.php b/wcfsetup/install/files/lib/system/gridView/action/ToggleAction.class.php index 57f8224479..fc07fa5e1a 100644 --- a/wcfsetup/install/files/lib/system/gridView/action/ToggleAction.class.php +++ b/wcfsetup/install/files/lib/system/gridView/action/ToggleAction.class.php @@ -24,6 +24,7 @@ class ToggleAction extends AbstractAction private readonly string $enableEndpoint, private readonly string $disableEndpoint, private readonly string $propertyName = 'isDisabled', + private readonly bool $propertyIsDisabledState = true, ?Closure $isAvailableCallback = null ) { parent::__construct($isAvailableCallback); @@ -44,7 +45,8 @@ class ToggleAction extends AbstractAction ); $ariaLabel = WCF::getLanguage()->get('wcf.global.button.enable'); - $checked = !$row->{$this->propertyName} ? 'checked' : ''; + $checked = (!$row->{$this->propertyName} && $this->propertyIsDisabledState) + || ($row->{$this->propertyName} && !$this->propertyIsDisabledState) ? 'checked' : ''; return << -- 2.20.1