Fix location and namespace of object type form node interface/trait
authorMatthias Schmidt <gravatronics@live.com>
Sun, 10 Mar 2019 10:01:50 +0000 (11:01 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 10 Mar 2019 10:01:50 +0000 (11:01 +0100)
See #2509

wcfsetup/install/files/lib/system/form/builder/IObjectTypeFormNode.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/form/builder/TObjectTypeFormNode.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/form/builder/button/wysiwyg/WysiwygPreviewFormButton.class.php
wcfsetup/install/files/lib/system/form/builder/container/wysiwyg/WysiwygFormContainer.class.php
wcfsetup/install/files/lib/system/form/builder/container/wysiwyg/WysiwygPollFormContainer.class.php
wcfsetup/install/files/lib/system/form/builder/field/CaptchaFormField.class.php
wcfsetup/install/files/lib/system/form/builder/field/IObjectTypeFormNode.class.php [deleted file]
wcfsetup/install/files/lib/system/form/builder/field/TObjectTypeFormNode.class.php [deleted file]
wcfsetup/install/files/lib/system/form/builder/field/acl/AclFormField.class.php
wcfsetup/install/files/lib/system/form/builder/field/tag/TagFormField.class.php
wcfsetup/install/files/lib/system/form/builder/field/wysiwyg/WysiwygFormField.class.php

diff --git a/wcfsetup/install/files/lib/system/form/builder/IObjectTypeFormNode.class.php b/wcfsetup/install/files/lib/system/form/builder/IObjectTypeFormNode.class.php
new file mode 100644 (file)
index 0000000..98420c5
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+namespace wcf\system\form\builder;
+use wcf\data\object\type\ObjectType;
+use wcf\system\exception\InvalidObjectTypeException;
+
+/**
+ * Represents a form node that relies on a specific object type.
+ * 
+ * @author     Matthias Schmidt
+ * @copyright  2001-2019 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    WoltLabSuite\Core\System\Form\Builder\Field
+ * @since      5.2
+ */
+interface IObjectTypeFormNode {
+       /**
+        * Returns the object type.
+        * 
+        * @return      ObjectType                      object type
+        *
+        * @throws      \BadMethodCallException         if object type has not been set
+        */
+       public function getObjectType();
+       
+       /**
+        * Sets the name of the object type and returns this field.
+        *
+        * @param       string          $objectType     object type name
+        * @return      IObjectTypeFormNode             this field
+        *
+        * @throws      \BadMethodCallException         if object type has already been set
+        * @throws      \UnexpectedValueException       if object type definition returned by `getObjectTypeDefinition()` is unknown
+        * @throws      InvalidObjectTypeException      if given object type name is invalid
+        */
+       public function objectType($objectType);
+       
+       /**
+        * Returns the name of the object type definition the set object type must be of.
+        * 
+        * @return      string          name of object type's definition
+        */
+       public function getObjectTypeDefinition();
+}
diff --git a/wcfsetup/install/files/lib/system/form/builder/TObjectTypeFormNode.class.php b/wcfsetup/install/files/lib/system/form/builder/TObjectTypeFormNode.class.php
new file mode 100644 (file)
index 0000000..90d28c9
--- /dev/null
@@ -0,0 +1,71 @@
+<?php
+namespace wcf\system\form\builder;
+use wcf\data\object\type\ObjectType;
+use wcf\data\object\type\ObjectTypeCache;
+use wcf\system\exception\InvalidObjectTypeException;
+
+/**
+ * Provides default implementations of `IObjectTypeFormNode` methods.
+ * 
+ * @author     Matthias Schmidt
+ * @copyright  2001-2019 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    WoltLabSuite\Core\System\Form\Builder\Field
+ * @since      5.2
+ */
+trait TObjectTypeFormNode {
+       /**
+        * object type
+        * @var null|ObjectType
+        */
+       protected $objectType;
+       
+       /**
+        * Returns the object type.
+        * 
+        * @return      ObjectType                      object type
+        * 
+        * @throws      \BadMethodCallException         if object type has not been set
+        */
+       public function getObjectType() {
+               if ($this->objectType === null) {
+                       throw new \BadMethodCallException("Object type has not been set.");
+               }
+               
+               return $this->objectType;
+       }
+       
+       /**
+        * Sets the name of the object type and returns this field.
+        * 
+        * @param       string          $objectType     object type name
+        * @return      static                          this field
+        * 
+        * @throws      \BadMethodCallException         if object type has already been set
+        * @throws      \UnexpectedValueException       if object type definition returned by `getObjectTypeDefinition()` is unknown
+        * @throws      InvalidObjectTypeException      if given object type name is invalid
+        */
+       public function objectType($objectType) {
+               if ($this->objectType !== null) {
+                       throw new \BadMethodCallException("Object type has already been set.");
+               }
+               
+               if (ObjectTypeCache::getInstance()->getDefinitionByName($this->getObjectTypeDefinition()) === null) {
+                       throw new \UnexpectedValueException("Unknown definition name '{$this->getObjectTypeDefinition()}'.");
+               }
+               
+               $this->objectType = ObjectTypeCache::getInstance()->getObjectTypeByName($this->getObjectTypeDefinition(), $objectType);
+               if ($this->objectType === null) {
+                       throw new InvalidObjectTypeException($objectType, $this->getObjectTypeDefinition());
+               }
+               
+               return $this;
+       }
+       
+       /**
+        * Returns the name of the object type definition the set object type must be of.
+        *
+        * @return      string          name of object type's definition
+        */
+       abstract public function getObjectTypeDefinition();
+}
index ce960c089e2fb28ea4e637b718bd1bf3fd8a3ffa..212aaa408169d6006adfbe26f75f26629d43a758 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 namespace wcf\system\form\builder\button\wysiwyg;
 use wcf\system\form\builder\button\FormButton;
-use wcf\system\form\builder\field\IObjectTypeFormNode;
-use wcf\system\form\builder\field\TObjectTypeFormNode;
+use wcf\system\form\builder\IObjectTypeFormNode;
+use wcf\system\form\builder\TObjectTypeFormNode;
 use wcf\system\form\builder\TWysiwygFormNode;
 
 /**
index bc36751a65abbc44c397847088fea145485a2e8b..553ef12e6a9744749d01f558c82f51012c7646cc 100644 (file)
@@ -104,7 +104,7 @@ class WysiwygFormContainer extends FormContainer {
        
        /**
         * actual wysiwyg form field
-        * @var WysiwygFormNode
+        * @var WysiwygFormField
         */
        protected $wysiwygField;
        
index e658c460dbd4a7823dc3906932514bb9f13de4c2..b1695cd3abe79e8d1213aa5df05794c21744d76c 100644 (file)
@@ -8,13 +8,13 @@ use wcf\system\form\builder\field\BooleanFormField;
 use wcf\system\form\builder\field\data\processor\CustomFormFieldDataProcessor;
 use wcf\system\form\builder\field\DateFormField;
 use wcf\system\form\builder\field\IntegerFormField;
-use wcf\system\form\builder\field\IObjectTypeFormNode;
 use wcf\system\form\builder\field\poll\PollOptionsFormField;
 use wcf\system\form\builder\field\TextFormField;
-use wcf\system\form\builder\field\TObjectTypeFormNode;
 use wcf\system\form\builder\field\validation\FormFieldValidationError;
 use wcf\system\form\builder\field\validation\FormFieldValidator;
 use wcf\system\form\builder\IFormDocument;
+use wcf\system\form\builder\IObjectTypeFormNode;
+use wcf\system\form\builder\TObjectTypeFormNode;
 use wcf\system\form\builder\TWysiwygFormNode;
 use wcf\system\poll\IPollHandler;
 
index 735e9fc9b737646bd147b1e25a26967012fbfd87..c3f111ac7c3aad618d409bc0846d19f0c3201bed 100644 (file)
@@ -1,6 +1,8 @@
 <?php
 namespace wcf\system\form\builder\field;
 use wcf\system\captcha\ICaptchaHandler;
+use wcf\system\form\builder\IObjectTypeFormNode;
+use wcf\system\form\builder\TObjectTypeFormNode;
 
 /**
  * Implementation of a form field for a captcha.
diff --git a/wcfsetup/install/files/lib/system/form/builder/field/IObjectTypeFormNode.class.php b/wcfsetup/install/files/lib/system/form/builder/field/IObjectTypeFormNode.class.php
deleted file mode 100644 (file)
index e43b7cd..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-namespace wcf\system\form\builder\field;
-use wcf\data\object\type\ObjectType;
-use wcf\system\exception\InvalidObjectTypeException;
-
-/**
- * Represents a form node that relies on a specific object type.
- * 
- * @author     Matthias Schmidt
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    WoltLabSuite\Core\System\Form\Builder\Field
- * @since      5.2
- */
-interface IObjectTypeFormNode {
-       /**
-        * Returns the object type.
-        * 
-        * @return      ObjectType                      object type
-        *
-        * @throws      \BadMethodCallException         if object type has not been set
-        */
-       public function getObjectType();
-       
-       /**
-        * Sets the name of the object type and returns this field.
-        *
-        * @param       string          $objectType     object type name
-        * @return      IObjectTypeFormNode             this field
-        *
-        * @throws      \BadMethodCallException         if object type has already been set
-        * @throws      \UnexpectedValueException       if object type definition returned by `getObjectTypeDefinition()` is unknown
-        * @throws      InvalidObjectTypeException      if given object type name is invalid
-        */
-       public function objectType($objectType);
-       
-       /**
-        * Returns the name of the object type definition the set object type must be of.
-        * 
-        * @return      string          name of object type's definition
-        */
-       public function getObjectTypeDefinition();
-}
diff --git a/wcfsetup/install/files/lib/system/form/builder/field/TObjectTypeFormNode.class.php b/wcfsetup/install/files/lib/system/form/builder/field/TObjectTypeFormNode.class.php
deleted file mode 100644 (file)
index 3de1d38..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-namespace wcf\system\form\builder\field;
-use wcf\data\object\type\ObjectType;
-use wcf\data\object\type\ObjectTypeCache;
-use wcf\system\exception\InvalidObjectTypeException;
-
-/**
- * Provides default implementations of `IObjectTypeFormNode` methods.
- * 
- * @author     Matthias Schmidt
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    WoltLabSuite\Core\System\Form\Builder\Field
- * @since      5.2
- */
-trait TObjectTypeFormNode {
-       /**
-        * object type
-        * @var null|ObjectType
-        */
-       protected $objectType;
-       
-       /**
-        * Returns the object type.
-        * 
-        * @return      ObjectType                      object type
-        * 
-        * @throws      \BadMethodCallException         if object type has not been set
-        */
-       public function getObjectType() {
-               if ($this->objectType === null) {
-                       throw new \BadMethodCallException("Object type has not been set.");
-               }
-               
-               return $this->objectType;
-       }
-       
-       /**
-        * Sets the name of the object type and returns this field.
-        * 
-        * @param       string          $objectType     object type name
-        * @return      static                          this field
-        * 
-        * @throws      \BadMethodCallException         if object type has already been set
-        * @throws      \UnexpectedValueException       if object type definition returned by `getObjectTypeDefinition()` is unknown
-        * @throws      InvalidObjectTypeException      if given object type name is invalid
-        */
-       public function objectType($objectType) {
-               if ($this->objectType !== null) {
-                       throw new \BadMethodCallException("Object type has already been set.");
-               }
-               
-               if (ObjectTypeCache::getInstance()->getDefinitionByName($this->getObjectTypeDefinition()) === null) {
-                       throw new \UnexpectedValueException("Unknown definition name '{$this->getObjectTypeDefinition()}'.");
-               }
-               
-               $this->objectType = ObjectTypeCache::getInstance()->getObjectTypeByName($this->getObjectTypeDefinition(), $objectType);
-               if ($this->objectType === null) {
-                       throw new InvalidObjectTypeException($objectType, $this->getObjectTypeDefinition());
-               }
-               
-               return $this;
-       }
-       
-       /**
-        * Returns the name of the object type definition the set object type must be of.
-        *
-        * @return      string          name of object type's definition
-        */
-       abstract public function getObjectTypeDefinition();
-}
index 02a6e5424d128bcc9029a93c6b943eee95c507be..d2d88bf9df58a7db4f945f82b1fd6d56db73b6b7 100644 (file)
@@ -4,9 +4,9 @@ use wcf\data\IStorableObject;
 use wcf\system\acl\ACLHandler;
 use wcf\system\form\builder\field\AbstractFormField;
 use wcf\system\form\builder\field\data\processor\CustomFormFieldDataProcessor;
-use wcf\system\form\builder\field\IObjectTypeFormNode;
-use wcf\system\form\builder\field\TObjectTypeFormNode;
 use wcf\system\form\builder\IFormDocument;
+use wcf\system\form\builder\IObjectTypeFormNode;
+use wcf\system\form\builder\TObjectTypeFormNode;
 
 /**
  * Implementation of a form field for setting acl option values.
index e8b6de0d4d7a5a2323269e302604287039938c8e..25be285577537206349f0e18a8a0fd9cd17cbaec 100644 (file)
@@ -4,10 +4,10 @@ use wcf\data\tag\Tag;
 use wcf\data\IStorableObject;
 use wcf\system\form\builder\field\AbstractFormField;
 use wcf\system\form\builder\field\data\processor\CustomFormFieldDataProcessor;
-use wcf\system\form\builder\field\IObjectTypeFormNode;
 use wcf\system\form\builder\field\TDefaultIdFormField;
-use wcf\system\form\builder\field\TObjectTypeFormNode;
 use wcf\system\form\builder\IFormDocument;
+use wcf\system\form\builder\IObjectTypeFormNode;
+use wcf\system\form\builder\TObjectTypeFormNode;
 use wcf\system\tagging\TagEngine;
 use wcf\util\ArrayUtil;
 
index 097cb009ccd616f2cf9386e9fa9f2c7921ad7ff1..3779037b8500d2f847caf9fbc9c0a77cfeb55b06 100644 (file)
@@ -4,12 +4,12 @@ use wcf\system\form\builder\field\AbstractFormField;
 use wcf\system\form\builder\field\data\processor\CustomFormFieldDataProcessor;
 use wcf\system\form\builder\field\IMaximumLengthFormField;
 use wcf\system\form\builder\field\IMinimumLengthFormField;
-use wcf\system\form\builder\field\IObjectTypeFormNode;
 use wcf\system\form\builder\field\TMaximumLengthFormField;
 use wcf\system\form\builder\field\TMinimumLengthFormField;
-use wcf\system\form\builder\field\TObjectTypeFormNode;
 use wcf\system\form\builder\field\validation\FormFieldValidationError;
 use wcf\system\form\builder\IFormDocument;
+use wcf\system\form\builder\IObjectTypeFormNode;
+use wcf\system\form\builder\TObjectTypeFormNode;
 use wcf\system\html\input\HtmlInputProcessor;
 use wcf\util\StringUtil;
 
@@ -66,8 +66,7 @@ class WysiwygFormField extends AbstractFormField implements IMaximumLengthFormFi
         * Sets the identifier used to autosave the field value and returns this field.
         * 
         * @param       string          $autosaveId     identifier used to autosave field value
-        *
-        * @return        WysiwygFormNode               this field
+        * @return      WysiwygFormField                this field
         */
        public function autosaveId($autosaveId) {
                $this->autosaveId = $autosaveId;
@@ -113,8 +112,7 @@ class WysiwygFormField extends AbstractFormField implements IMaximumLengthFormFi
         * Sets the last time this field has been edited and returns this field.
         * 
         * @param       int     $lastEditTime   last time field has been edited
-        *
-        * @return        WysiwygFormNode       this field
+        * @return      WysiwygFormField        this field
         */
        public function lastEditTime($lastEditTime) {
                $this->lastEditTime = $lastEditTime;
@@ -158,8 +156,7 @@ class WysiwygFormField extends AbstractFormField implements IMaximumLengthFormFi
         * Sets if the form field supports attachments and returns this field.
         * 
         * @param       boolean         $supportAttachments
-        *
-        * @return        WysiwygFormNode
+        * @return      WysiwygFormField                this field
         */
        public function supportAttachments($supportAttachments = true) {
                $this->supportAttachments = $supportAttachments;
@@ -171,8 +168,7 @@ class WysiwygFormField extends AbstractFormField implements IMaximumLengthFormFi
         * Sets if the form field supports mentions and returns this field.
         * 
         * @param       boolean         $supportMentions
-        *
-        * @return        WysiwygFormNode
+        * @return      WysiwygFormField                this field
         */
        public function supportMentions($supportMentions = true) {
                $this->supportMentions = $supportMentions;