Button.php
Go to the documentation of this file.
1<?php
11
13
39{
40 protected $defaultValue = "";
41
51 protected function setDefaults()
52 {
53 parent::setDefaults();
54
55 $this->defaults['defaultValue'] = false;
56 }
57
67 public function setValue($newValue)
68 {
69 if (is_bool($newValue)) {
70 $this->value = $newValue;
71 } elseif ($newValue === "true") {
72 $this->value = true;
73 } else {
74 $this->value = false;
75 }
76
77 return $this->value;
78 }
79
85 public function __toString()
86 {
87 $value = "true";
88 $type = "submit";
89 $inputAttributes = $this->htmlInputAttributes();
90 $marker = $this->htmlMarker();
91 $label = $this->htmlLabel();
92 $wrapperAttributes = $this->htmlWrapperAttributes();
95
96 return "<p {$wrapperAttributes}>" .
97 "<button name=\"{$this->name}\" type=\"submit\"{$inputAttributes} value=\"{$value}\">{$label}</button>" .
100 "</p>\n";
101 }
102}
103
104/* vim:set ft=php sw=4 sts=4 fdm=marker et : */
input element base class
Definition Input.php:21
htmlInputAttributes()
Returns string of HTML attributes for input element.
Definition Input.php:575
$value
Input elements's value.
Definition Input.php:123
$label
Input element - HTML label.
Definition Input.php:36
$errorMessage
Message that gets displayed in case of invalid input.
Definition Input.php:217
htmlHelpMessage()
Returns HTML-rendered helpMessage.
Definition Input.php:676
htmlWrapperAttributes()
Returns string of HTML attributes for element wrapper paragraph.
Definition Input.php:627
htmlMarker()
Returns elements' required-indicator.
Definition Input.php:565
$type
Input element type - HTML input type attribute.
Definition Input.php:25
$helpMessage
Extra help message.
Definition Input.php:229
$marker
Input element - HTML marker text that marks required fields.
Definition Input.php:91
htmlErrorMessage()
Returns HTML-rendered error message.
Definition Input.php:657
HTML text input type.
Definition Button.php:39
__toString()
Renders element to HTML.
Definition Button.php:85
setValue($newValue)
set the boolean element value
Definition Button.php:67
setDefaults()
collects initial values across subclasses
Definition Button.php:51
Abstract element classes.
Definition Container.php:10
Classes for HTML input-elements.
Definition Address.php:9