83 parent::setDefaults();
86 $this->defaults[
'disabled'] =
false;
87 $this->defaults[
'required'] =
false;
128 $this->form->checkElementName(
$name);
130 $newElement = parent::addElement($type,
$name, $parameters);
132 if ( !($newElement instanceof fieldset) ) {
133 $this->form->updateInputValue(
$name);
148 if ($this->required) {
149 $classes .=
' required';
151 if ($this->disabled) {
152 $classes .=
' disabled';
154 if (!empty($this->
class)) {
155 $classes .=
' ' . $this->
htmlEscape($this->
class);
158 return trim($classes);
170 $renderedElements =
'';
171 $formName = $this->form->getName();
172 $label = $this->htmlLabel();
175 $htmlAttributes =
"id=\"{$formName}-{$this->name}\"";
176 $htmlAttributes .=
" name=\"{$this->name}\"";
179 if (!empty($classes)) {
180 $htmlAttributes .=
" class=\"" . $classes .
"\"";
184 foreach ($this->elementsAndHtml as $element) {
185 $renderedElements .= $element;
188 return "<fieldset {$htmlAttributes}>" .
189 "<legend><span>{$label}</span></legend>{$renderedElements}" .
container element base class
htmlDataAttributes()
Returns dataAttr escaped as attribute string.
htmlEscape($options=array())
Escapes HTML in strings and arrays of strings.
The fieldset class holds HTML-fieldset specific attributes and methods.
addElement($type, $name, $parameters)
Generates sub-elements.
setDisabled($disabled=true)
Sets the HTML disabled-attribute of the current input element.
$required
HTML required attribute.
$disabled
HTML disabled attribute.
__toString()
Renders the fieldset to HTML code.
htmlClasses()
Returns string of the elements' HTML-classes, separated by spaces.
setDefaults()
collects initial values across subclasses.
getDisabled()
Gets if input is currently disabled.
Abstract element classes.
Classes for HTML input-elements.