From: Matthias Schmidt Date: Sat, 13 Oct 2018 13:25:03 +0000 (+0200) Subject: Add `disableAutocomplete` support for option types via PIP GUI X-Git-Tag: 5.2.0_Alpha_1~644 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=aa1e27353ab887d2969357360b5fd98eb8241bcf;p=GitHub%2FWoltLab%2FWCF.git Add `disableAutocomplete` support for option types via PIP GUI See #2545 See #2750 --- diff --git a/wcfsetup/install/files/lib/system/package/plugin/AbstractOptionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/AbstractOptionPackageInstallationPlugin.class.php index e8809f8522..951db47d73 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/AbstractOptionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/AbstractOptionPackageInstallationPlugin.class.php @@ -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) { diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 230c79e076..4e5f47ce97 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -2231,6 +2231,8 @@ If you have already bought the licenses for the listed apps, th + +