From f7d4884e801f9f1895fcda6eb11da351d9f2ff8e Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sat, 19 Dec 2020 13:16:55 +0100 Subject: [PATCH] Add autocomplete support for multiline text form field --- .../templates/__multilineTextFormField.tpl | 1 + .../files/acp/templates/__multilineTextFormField.tpl | 1 + .../builder/field/MultilineTextFormField.class.php | 11 +++++++++++ 3 files changed, 13 insertions(+) diff --git a/com.woltlab.wcf/templates/__multilineTextFormField.tpl b/com.woltlab.wcf/templates/__multilineTextFormField.tpl index b300045a17..3a114ecbe3 100644 --- a/com.woltlab.wcf/templates/__multilineTextFormField.tpl +++ b/com.woltlab.wcf/templates/__multilineTextFormField.tpl @@ -2,6 +2,7 @@ *}name="{@$field->getPrefixedId()}" {* *}rows="{@$field->getRows()}"{* *}{if !$field->getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}{* + *}{if $field->getAutoComplete() !== null} autocomplete="{$field->getAutoComplete()}"{/if}{* *}{if $field->isAutofocused()} autofocus{/if}{* *}{if $field->isRequired()} required{/if}{* *}{if $field->isImmutable()} disabled{/if}{* diff --git a/wcfsetup/install/files/acp/templates/__multilineTextFormField.tpl b/wcfsetup/install/files/acp/templates/__multilineTextFormField.tpl index b300045a17..3a114ecbe3 100644 --- a/wcfsetup/install/files/acp/templates/__multilineTextFormField.tpl +++ b/wcfsetup/install/files/acp/templates/__multilineTextFormField.tpl @@ -2,6 +2,7 @@ *}name="{@$field->getPrefixedId()}" {* *}rows="{@$field->getRows()}"{* *}{if !$field->getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}{* + *}{if $field->getAutoComplete() !== null} autocomplete="{$field->getAutoComplete()}"{/if}{* *}{if $field->isAutofocused()} autofocus{/if}{* *}{if $field->isRequired()} required{/if}{* *}{if $field->isImmutable()} disabled{/if}{* diff --git a/wcfsetup/install/files/lib/system/form/builder/field/MultilineTextFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/MultilineTextFormField.class.php index fea2317f2e..63805bf300 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/MultilineTextFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/MultilineTextFormField.class.php @@ -22,6 +22,17 @@ class MultilineTextFormField extends TextFormField { */ protected $templateName = '__multilineTextFormField'; + /** + * @inheritDoc + * @since 5.4 + */ + protected function getValidAutoCompleteTokens(): array { + return array_merge( + parent::getValidAutoCompleteTokens(), + ['street-address'] + ); + } + /** * Returns the number of rows of the textarea. If the number of rows has not been * explicitly set, `10` is returned. -- 2.20.1