Add automatic class form field description if certain parent class is required
authorMatthias Schmidt <gravatronics@live.com>
Sun, 14 Oct 2018 10:38:43 +0000 (12:38 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 14 Oct 2018 10:38:43 +0000 (12:38 +0200)
See #2509

wcfsetup/install/files/lib/system/form/builder/field/ClassNameFormField.class.php
wcfsetup/install/lang/en.xml

index 53ae5183bc5b569b6a4137eb54c52cec29e7c860..f054fbe992c9a225a792e02294f01ce9db0ad91c 100644 (file)
@@ -160,6 +160,13 @@ class ClassNameFormField extends TextFormField {
                
                $this->__parentClass = $parentClass;
                
+               if ($this->getDescription() === null) {
+                       $this->description(
+                               'wcf.form.field.className.description.parentClass',
+                               ['parentClass' => $this->__parentClass]
+                       );
+               }
+               
                return $this;
        }
        
index 6059565d22ac56ef801f90ad7aba29d8214b5d86..4e9698e2a4985ec5b5037c84e6cc5b7f6010264c 100644 (file)
@@ -3039,6 +3039,7 @@ Email: {@$emailAddress} {* this line ends with a space *}
        <category name="wcf.form">
                <item name="wcf.form.field.className"><![CDATA[Class]]></item>
                <item name="wcf.form.field.className.description.interface"><![CDATA[The entered class (without leading backslash) must implement the interface <code>{$interface}</code>.]]></item>
+               <item name="wcf.form.field.className.description.parentClass"><![CDATA[The entered class (without leading backslash) must extend the class <code>{$parentClass}</code>.]]></item>
                <item name="wcf.form.field.className.error.interface"><![CDATA[The entered class{if $language|isset} ({$language}){/if} does not implement the interface <code>{$interface}</code>.]]></item>
                <item name="wcf.form.field.className.error.isInstantiable"><![CDATA[The entered class{if $language|isset} ({$language}){/if} is not instantiable.]]></item>
                <item name="wcf.form.field.className.error.leadingBackslash"><![CDATA[The entered class name{if $language|isset} ({$language}){/if} must not have a leading backslash.]]></item>