Add input mode support for `EmailFormField`
authorMatthias Schmidt <gravatronics@live.com>
Mon, 21 Dec 2020 18:17:34 +0000 (19:17 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Mon, 21 Dec 2020 18:17:34 +0000 (19:17 +0100)
com.woltlab.wcf/templates/__emailFormField.tpl
wcfsetup/install/files/acp/templates/__emailFormField.tpl
wcfsetup/install/files/lib/system/form/builder/field/EmailFormField.class.php

index 2e6bb1b488a1c749071eac22233948df63f5a3cb..d04f9b189b33c71675598eb829977e7b6c3bc2aa 100644 (file)
@@ -8,6 +8,7 @@
        *}{if $field->isAutofocused()} autofocus{/if}{*
        *}{if $field->isRequired()} required{/if}{*
        *}{if $field->isImmutable()} disabled{/if}{*
+       *}{if $field->getInputMode() !== null} inputmode="{$field->getInputMode()}"{/if}{*
        *}{if $field->getPlaceholder() !== null} placeholder="{$field->getPlaceholder()}"{/if}{*
        *}{if $field->getDocument()->isAjax()} data-dialog-submit-on-enter="true"{/if}{*
 *}>
index 2e6bb1b488a1c749071eac22233948df63f5a3cb..d04f9b189b33c71675598eb829977e7b6c3bc2aa 100644 (file)
@@ -8,6 +8,7 @@
        *}{if $field->isAutofocused()} autofocus{/if}{*
        *}{if $field->isRequired()} required{/if}{*
        *}{if $field->isImmutable()} disabled{/if}{*
+       *}{if $field->getInputMode() !== null} inputmode="{$field->getInputMode()}"{/if}{*
        *}{if $field->getPlaceholder() !== null} placeholder="{$field->getPlaceholder()}"{/if}{*
        *}{if $field->getDocument()->isAjax()} data-dialog-submit-on-enter="true"{/if}{*
 *}>
index 8305975b10940666fb6c52893d46e1ecb74ddf77..465e4422ef0340d9a8688ec29cd8fbe318ce9409 100644 (file)
@@ -16,11 +16,12 @@ use wcf\util\UserUtil;
  * @package    WoltLabSuite\Core\System\Form\Builder\Field
  * @since      5.2
  */
-class EmailFormField extends AbstractFormField implements IAutoCompleteFormField, IAutoFocusFormField, ICssClassFormField, II18nFormField, IImmutableFormField, IPlaceholderFormField {
+class EmailFormField extends AbstractFormField implements IAutoCompleteFormField, IAutoFocusFormField, ICssClassFormField, II18nFormField, IImmutableFormField, IInputModeFormField, IPlaceholderFormField {
        use TAutoCompleteFormField;
        use TAutoFocusFormField;
        use TCssClassFormField;
        use TImmutableFormField;
+       use TInputModeFormField;
        use TI18nFormField {
                validate as protected i18nValidate;
        }
@@ -54,6 +55,13 @@ class EmailFormField extends AbstractFormField implements IAutoCompleteFormField
                }, ['home', 'work', 'mobile', 'fax', 'pager']));
        }
        
+       /**
+        * @inheritDoc
+        */
+       protected function getValidInputModes(): array {
+               return ['email'];
+       }
+       
        /**
         * @inheritDoc
         */