Add `disableAutocomplete` support for option types via PIP GUI
authorMatthias Schmidt <gravatronics@live.com>
Sat, 13 Oct 2018 13:25:03 +0000 (15:25 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sat, 13 Oct 2018 13:25:03 +0000 (15:25 +0200)
See #2545
See #2750

wcfsetup/install/files/lib/system/package/plugin/AbstractOptionPackageInstallationPlugin.class.php
wcfsetup/install/lang/en.xml

index e8809f85229164bb24467eca0884084060561e30..951db47d73eb7936513c0f62aa370b39b95ce822 100644 (file)
@@ -24,6 +24,7 @@ use wcf\system\option\II18nOptionType;
 use wcf\system\option\IOptionHandler;
 use wcf\system\option\IOptionType;
 use wcf\system\option\ISelectOptionOptionType;
+use wcf\system\option\TextOptionType;
 use wcf\system\Regex;
 use wcf\system\WCF;
 use wcf\util\DirectoryUtil;
@@ -50,6 +51,13 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag
         */
        public $i18nOptionTypes = [];
        
+       /**
+        * list of option types with i18n support extending `TextOptionType`
+        * (in addition to `text`)
+        * @var string[]
+        */
+       public $textOptionTypes = ['text'];
+       
        /**
         * list of option types with a pre-defined list of options via `selectOptions`
         * @var string[]
@@ -550,6 +558,10 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag
                                                                                        $this->selectOptionOptionTypes[] = $optionType;
                                                                                }
                                                                                
+                                                                               if (is_subclass_of($classname, TextOptionType::class)) {
+                                                                                       $this->textOptionTypes[] = $optionType;
+                                                                               }
+                                                                               
                                                                                $options[] = $optionType;
                                                                        }
                                                                }
@@ -696,6 +708,15 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag
                                                                ->field($optionType)
                                                                ->values(['select'])
                                                ),
+                                       
+                                       BooleanFormField::create('disableAutocomplete')
+                                               ->label('wcf.acp.pip.abstractOption.options.optionType.text.disableAutocomplete')
+                                               ->description('wcf.acp.pip.abstractOption.options.optionType.text.disableAutocomplete.description')
+                                               ->addDependency(
+                                                       ValueFormFieldDependency::create('optionType')
+                                                               ->field($optionType)
+                                                               ->values($this->textOptionTypes)
+                                               )
                                ]);
                                
                                break;
@@ -765,6 +786,7 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag
                                        'maxlength',
                                        'issortable',
                                        'allowemptyvalue',
+                                       'disableAutocomplete'
                                ];
                                
                                foreach ($optionals as $optionalPropertyName) {
@@ -1060,8 +1082,9 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag
                                        'suffix' => '',
                                        'minlength' => null,
                                        'maxlength' => null,
-                                       'issortable' => false,
-                                       'allowemptyvalue' => false
+                                       'issortable' => 0,
+                                       'allowemptyvalue' => 0,
+                                       'disableAutocomplete' => 0
                                ];
                                foreach ($fields as $field => $defaultValue) {
                                        if (isset($formData[$field]) && $formData[$field] !== $defaultValue) {
index 230c79e07636837996664947b63e1077f9958948..4e5f47ce97ca4bef0ee14790958b988e4c9156ba 100644 (file)
@@ -2231,6 +2231,8 @@ If you have <strong>already bought the licenses for the listed apps</strong>, th
                <item name="wcf.acp.pip.objectType.com.woltlab.wcf.user.recentActivityEvent.supportsReactions"><![CDATA[Supports Reactions]]></item>
                <item name="wcf.acp.pip.objectType.com.woltlab.wcf.user.recentActivityEvent.supportsReactions.description"><![CDATA[TODO]]></item>
                <item name="wcf.acp.pip.objectType.com.woltlab.wcf.user.recentActivityEvent.data.title"><![CDATA[Recent Activity Event Data]]></item>
+               <item name="wcf.acp.pip.abstractOption.options.optionType.text.disableAutocomplete"><![CDATA[Disable Autocomplete]]></item>
+               <item name="wcf.acp.pip.abstractOption.options.optionType.text.disableAutocomplete.description"><![CDATA[Disables the browser’s autocomplete support for the input field.]]></item>
        </category>
        
        <category name="wcf.acp.reactionType">