summaryrefslogtreecommitdiffstats
path: root/vendor/ipl/html/src/FormElement/SelectOption.php
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:38:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:38:04 +0000
commit1ff5c35de5dbd70a782875a91dd2232fd01b002b (patch)
tree77d9ce5e1bf78b3e6ef79f8f6e7861e2ced3c09b /vendor/ipl/html/src/FormElement/SelectOption.php
parentInitial commit. (diff)
downloadicinga-php-library-1ff5c35de5dbd70a782875a91dd2232fd01b002b.tar.xz
icinga-php-library-1ff5c35de5dbd70a782875a91dd2232fd01b002b.zip
Adding upstream version 0.10.1.upstream/0.10.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/ipl/html/src/FormElement/SelectOption.php')
-rw-r--r--vendor/ipl/html/src/FormElement/SelectOption.php45
1 files changed, 45 insertions, 0 deletions
diff --git a/vendor/ipl/html/src/FormElement/SelectOption.php b/vendor/ipl/html/src/FormElement/SelectOption.php
new file mode 100644
index 0000000..d0dbf7c
--- /dev/null
+++ b/vendor/ipl/html/src/FormElement/SelectOption.php
@@ -0,0 +1,45 @@
+<?php
+
+namespace ipl\Html\FormElement;
+
+use ipl\Html\BaseHtmlElement;
+
+class SelectOption extends BaseHtmlElement
+{
+ protected $tag = 'option';
+
+ /** @var mixed */
+ protected $value;
+
+ /**
+ * SelectOption constructor.
+ * @param string|null $value
+ * @param string|null $label
+ */
+ public function __construct($value = null, $label = null)
+ {
+ $this->value = $value;
+ $this->add($label);
+
+ $this->getAttributes()->registerAttributeCallback('value', [$this, 'getValue']);
+ }
+
+ /**
+ * @param $label
+ * @return $this
+ */
+ public function setLabel($label)
+ {
+ $this->setContent($label);
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getValue()
+ {
+ return $this->value;
+ }
+}