Add `CustomFormNode`
authorMatthias Schmidt <gravatronics@live.com>
Sat, 13 Apr 2019 10:54:34 +0000 (12:54 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sat, 13 Apr 2019 10:54:34 +0000 (12:54 +0200)
See #2509

wcfsetup/install/files/lib/system/form/builder/CustomFormNode.class.php [new file with mode: 0644]

diff --git a/wcfsetup/install/files/lib/system/form/builder/CustomFormNode.class.php b/wcfsetup/install/files/lib/system/form/builder/CustomFormNode.class.php
new file mode 100644 (file)
index 0000000..6bd0c5d
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+namespace wcf\system\form\builder;
+
+/**
+ * Form node whose contents can be set directly.
+ * 
+ * This node should generally not be used. Instead, `TemplateFormNode` should be used.
+ * 
+ * @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
+ * @since      5.2
+ */
+class CustomFormNode implements IFormChildNode {
+       use TFormChildNode;
+       use TFormNode;
+       
+       /**
+        * content of the custom form node
+        * @var string
+        */
+       protected $content = '';
+       
+       /**
+        * Sets the content of this form node and returns this form node.
+        * 
+        * @param       string          $content
+        * @return      static          this form node
+        */
+       public function content($content) {
+               $this->content = $content;
+               
+               return $this;
+       }
+       
+       /**
+        * Returns the content of the custom form node.
+        * 
+        * @return      string
+        */
+       public function getContent() {
+               return $this->content;
+       }
+       
+       /**
+        * @inheritDoc
+        */
+       public function getHtml() {
+               return $this->getContent();
+       }
+       
+       /**
+        * @inheritDoc
+        */
+       public function validate() {
+               // does nothing
+       }
+}