summaryrefslogtreecommitdiff
path: root/inc/Form/ButtonElement.php
diff options
context:
space:
mode:
authorGuy Brand <gb@unistra.fr>2015-08-23 15:54:03 +0200
committerGuy Brand <gb@unistra.fr>2015-08-23 15:54:03 +0200
commitd1c5a21205ecdf83c4cbdcd9245556121688e798 (patch)
treef99aacf8e4e2aad00b106d9b905a14c3536ba935 /inc/Form/ButtonElement.php
parent2beabe635c6b98fcf412ba42d137a5de33543109 (diff)
parent0f0d29909c63f9897c9c003e6d3e3b8381a6f36d (diff)
downloadrpg-d1c5a21205ecdf83c4cbdcd9245556121688e798.tar.gz
rpg-d1c5a21205ecdf83c4cbdcd9245556121688e798.tar.bz2
Merge branch 'master' into stable
Diffstat (limited to 'inc/Form/ButtonElement.php')
-rw-r--r--inc/Form/ButtonElement.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/inc/Form/ButtonElement.php b/inc/Form/ButtonElement.php
new file mode 100644
index 000000000..77c30ed4f
--- /dev/null
+++ b/inc/Form/ButtonElement.php
@@ -0,0 +1,34 @@
+<?php
+namespace dokuwiki\Form;
+
+/**
+ * Class ButtonElement
+ *
+ * Represents a simple button
+ *
+ * @package dokuwiki\Form
+ */
+class ButtonElement extends Element {
+
+ /** @var string HTML content */
+ protected $content = '';
+
+ /**
+ * @param string $name
+ * @param string $content HTML content of the button. You have to escape it yourself.
+ */
+ function __construct($name, $content = '') {
+ parent::__construct('button', array('name' => $name, 'value' => 1));
+ $this->content = $content;
+ }
+
+ /**
+ * The HTML representation of this element
+ *
+ * @return string
+ */
+ public function toHTML() {
+ return '<button ' . buildAttributes($this->attrs()) . '>'.$this->content.'</button>';
+ }
+
+}