Add field attribute support for `ButtonFormField`
authorMatthias Schmidt <gravatronics@live.com>
Wed, 23 Dec 2020 14:22:08 +0000 (15:22 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Wed, 23 Dec 2020 14:24:19 +0000 (15:24 +0100)
com.woltlab.wcf/templates/__buttonFormField.tpl
wcfsetup/install/files/acp/templates/__buttonFormField.tpl
wcfsetup/install/files/lib/system/form/builder/field/ButtonFormField.class.php

index f8e4d17009a41df6c70b0d88c9cb26d45590ac43..9e1bf13304eda68bc2ec348b959ea421cf7a36d7 100644 (file)
@@ -4,4 +4,5 @@
        *}name="{@$field->getPrefixedId()}" {*
        *}value="{$field->getValue()}"{*
        *}{if !$field->getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}{*
+       *}{foreach from=$field->getFieldAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{*
 *}>{$field->getButtonLabel()}</button>
index f8e4d17009a41df6c70b0d88c9cb26d45590ac43..9e1bf13304eda68bc2ec348b959ea421cf7a36d7 100644 (file)
@@ -4,4 +4,5 @@
        *}name="{@$field->getPrefixedId()}" {*
        *}value="{$field->getValue()}"{*
        *}{if !$field->getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}{*
+       *}{foreach from=$field->getFieldAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{*
 *}>{$field->getButtonLabel()}</button>
index f64ccfe0e2a85aee0b00079c869a259418da49e5..b6edc8e3ae7c857b469d11403a62a9ccc743576d 100644 (file)
@@ -13,7 +13,8 @@ use wcf\system\WCF;
  * @package     WoltLabSuite\Core\System\Form\Builder\Field
  * @since       5.4
  */
-class ButtonFormField extends AbstractFormField implements ICssClassFormField {
+class ButtonFormField extends AbstractFormField implements IAttributeFormField, ICssClassFormField {
+       use TInputAttributeFormField;
        use TCssClassFormField;
        
        /**