Change URL form field to `input type="url"`
authorMarcel Werk <burntime@woltlab.com>
Thu, 27 Apr 2023 11:32:10 +0000 (13:32 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 27 Apr 2023 14:03:37 +0000 (16:03 +0200)
Closes #5266

com.woltlab.wcf/templates/__textFormField.tpl
wcfsetup/install/files/acp/templates/__textFormField.tpl
wcfsetup/install/files/lib/system/form/builder/field/TextFormField.class.php
wcfsetup/install/files/lib/system/form/builder/field/UrlFormField.class.php

index edf75553799bb0545afd5cc96b19df580d790035..dfcfde60bdc292189dd6ec8876b2856bfb3c597f 100644 (file)
@@ -1,4 +1,4 @@
-<input type="text" {*
+<input type="{$field->getInputType()}" {*
        *}id="{$field->getPrefixedId()}" {*
        *}name="{$field->getPrefixedId()}" {*
        *}value="{if !$field->isI18n() || !$field->hasI18nValues() || $availableLanguages|count === 1}{$field->getValue()}{/if}"{*
index edf75553799bb0545afd5cc96b19df580d790035..dfcfde60bdc292189dd6ec8876b2856bfb3c597f 100644 (file)
@@ -1,4 +1,4 @@
-<input type="text" {*
+<input type="{$field->getInputType()}" {*
        *}id="{$field->getPrefixedId()}" {*
        *}name="{$field->getPrefixedId()}" {*
        *}value="{if !$field->isI18n() || !$field->hasI18nValues() || $availableLanguages|count === 1}{$field->getValue()}{/if}"{*
index f5577f924de61bc85fd72cc5d841d7894e48809e..65f4fd82d516853a9a845250a811076f71dfeef6 100644 (file)
@@ -115,4 +115,13 @@ class TextFormField extends AbstractFormField implements
         $this->validateMinimumLength($text, $language);
         $this->validateMaximumLength($text, $language);
     }
+
+    /**
+     * Returns the value for the `type` attribute of the input field.
+     * @since 6.0
+     */
+    public function getInputType(): string
+    {
+        return 'text';
+    }
 }
index 288e11b710048f91f328b2dc761912e8214a6f45..ade83d429519a9b09b6cf26aeb6d5fd26c3eaca0 100644 (file)
@@ -56,4 +56,12 @@ class UrlFormField extends TextFormField
             }
         }
     }
+
+    /**
+     * @inheritDoc
+     */
+    public function getInputType(): string
+    {
+        return 'url';
+    }
 }