summaryrefslogtreecommitdiff
path: root/platform/www/inc/Form/ValueElement.php
diff options
context:
space:
mode:
Diffstat (limited to 'platform/www/inc/Form/ValueElement.php')
-rw-r--r--platform/www/inc/Form/ValueElement.php45
1 files changed, 45 insertions, 0 deletions
diff --git a/platform/www/inc/Form/ValueElement.php b/platform/www/inc/Form/ValueElement.php
new file mode 100644
index 0000000..88db167
--- /dev/null
+++ b/platform/www/inc/Form/ValueElement.php
@@ -0,0 +1,45 @@
+<?php
+
+namespace dokuwiki\Form;
+
+/**
+ * Class ValueElement
+ *
+ * Just like an Element but it's value is not part of its attributes
+ *
+ * What the value is (tag name, content, etc) is defined by the actual implementations
+ *
+ * @package dokuwiki\Form
+ */
+abstract class ValueElement extends Element {
+
+ /**
+ * @var string holds the element's value
+ */
+ protected $value = '';
+
+ /**
+ * @param string $type
+ * @param string $value
+ * @param array $attributes
+ */
+ public function __construct($type, $value, $attributes = array()) {
+ parent::__construct($type, $attributes);
+ $this->val($value);
+ }
+
+ /**
+ * Get or set the element's value
+ *
+ * @param null|string $value
+ * @return string|$this
+ */
+ public function val($value = null) {
+ if($value !== null) {
+ $this->value = $value;
+ return $this;
+ }
+ return $this->value;
+ }
+
+}