summaryrefslogtreecommitdiffstats
path: root/vendor/ipl/html/src/FormElement/SubmitElement.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ipl/html/src/FormElement/SubmitElement.php')
-rw-r--r--vendor/ipl/html/src/FormElement/SubmitElement.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/vendor/ipl/html/src/FormElement/SubmitElement.php b/vendor/ipl/html/src/FormElement/SubmitElement.php
new file mode 100644
index 0000000..51d4aa5
--- /dev/null
+++ b/vendor/ipl/html/src/FormElement/SubmitElement.php
@@ -0,0 +1,50 @@
+<?php
+
+namespace ipl\Html\FormElement;
+
+use ipl\Html\Attribute;
+use ipl\Html\Contract\FormSubmitElement;
+
+class SubmitElement extends InputElement implements FormSubmitElement
+{
+ protected $type = 'submit';
+
+ protected $buttonLabel;
+
+ public function setLabel($label)
+ {
+ $this->buttonLabel = $label;
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getButtonLabel()
+ {
+ if ($this->buttonLabel === null) {
+ return $this->getName();
+ } else {
+ return $this->buttonLabel;
+ }
+ }
+
+ /**
+ * @return mixed|static
+ */
+ public function getValueAttribute()
+ {
+ return new Attribute('value', $this->getButtonLabel());
+ }
+
+ public function hasBeenPressed()
+ {
+ return $this->getButtonLabel() === $this->getValue();
+ }
+
+ public function isIgnored()
+ {
+ return true;
+ }
+}