From: Matthias Schmidt Date: Mon, 22 Mar 2021 11:58:39 +0000 (+0100) Subject: Extend documentation of `ObjectActionFunctionTemplatePlugin` X-Git-Tag: 5.4.0_Alpha_1~132^2~4 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=aaec1d59916cc41b01cf729505a0cbc55b5a36d1;p=GitHub%2FWoltLab%2FWCF.git Extend documentation of `ObjectActionFunctionTemplatePlugin` --- diff --git a/wcfsetup/install/files/lib/system/template/plugin/ObjectActionFunctionTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/ObjectActionFunctionTemplatePlugin.class.php index e0d84a3ed1..0680121a92 100644 --- a/wcfsetup/install/files/lib/system/template/plugin/ObjectActionFunctionTemplatePlugin.class.php +++ b/wcfsetup/install/files/lib/system/template/plugin/ObjectActionFunctionTemplatePlugin.class.php @@ -10,7 +10,31 @@ use wcf\util\StringUtil; * Template function plugin which generate delete and toggle buttons for objects to be used in * combination with `WoltLabSuite/Core/Ui/Object/Action`. * - * TODO: More information and examples + * Required argument: `action` with value `delete` or `toggle`. + * Optional arguments for all actions: + * - `objectId` (to override the objectId set via the `data-object-id` attribute by the closest + * `jsObjectActionObject` element) + * - `className` (to override the objectId set via the `data-object-action-class-name` attribute + * by the closest `jsObjectActionContainer` element) + * - attributes beginning with `parameter` are mapped to `data-object-action-parameter-*` + * attributes of the button + * + * One of the following aguments for `delete` action is required: + * - `objectTitle`: name of the object used in the `wcf.global.button.delete.confirmMessage` + * confirmation language item + * - `confirmMessage`: confirmation message or confirmation language item + * + * Arguments for `toggle` action: + * - `isDisabled` (required): indicates the current toggle state of the relevant object + * - `disableTitle`: title or language item with the title of the button for the disable action + * - `enableTitle`: title or language item with the title of the button for the enable action + * + * Examples: + * + * {objectAction action="delete" objectTitle=$object->getTitle()} + * {objectAction action="delete" confirmMessage='wcf.foo.delete.confirmMessage' parameterFoo='bar'} + * {objectAction action="toggle" isDisabled=$object->isDisabled} + * {objectAction action="toggle" isDisabled=$object->isDisabled disableTitle='wcf.foo.button.disable' enableTitle='wcf.foo.button.enable'} * * @author Matthias Schmidt * @copyright 2001-2021 WoltLab GmbH