From bf37a128ea8d1683278de75f122df05f03c3977e Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Tue, 8 May 2018 08:07:50 +0200 Subject: [PATCH] Add default description for class name form fields with required interface See #2509 --- .../form/builder/field/ClassNameFormField.class.php | 13 ++++++++++++- wcfsetup/install/lang/de.xml | 1 + wcfsetup/install/lang/en.xml | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/form/builder/field/ClassNameFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/ClassNameFormField.class.php index 4372cf608c..25f06a8b0e 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/ClassNameFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/ClassNameFormField.class.php @@ -103,7 +103,11 @@ class ClassNameFormField extends TextFormField { } /** - * Returns the name of the interface the entered class must implement. + * Sets the name of the interface the entered class must implement and returns + * this field. + * + * If no description has been set yet, `wcf.form.field.className.description.interface` + * is automatically used for the description. * * @param string $interface name of the interface the entered class must implement * @return static this field @@ -117,6 +121,13 @@ class ClassNameFormField extends TextFormField { $this->__implementedInterface = $interface; + if ($this->getDescription() === null) { + $this->description( + 'wcf.form.field.className.description.interface', + ['interface' => $this->__implementedInterface] + ); + } + return $this; } diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index de68659dc0..d414f7aa9a 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -3018,6 +3018,7 @@ E-Mail-Adresse: {@$emailAddress} {* this line ends with a space *} + {$interface} implementieren.]]> {$interface}.]]> diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 0da26790d6..841a656415 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -2964,6 +2964,7 @@ Email: {@$emailAddress} {* this line ends with a space *} + {$interface}.]]> {$interface}.]]> -- 2.20.1