38 require_once realpath(dirname(__FILE__)).
"/../field_renderers.inc";
62 $this->hideLabel =
true;
68 if (!
$parent->data->hasField($field))
70 $parent->add($this, $field, $label);
74 $parent->override($field, $label, $this);
81 $label = isset($this->label) ? $this->label : $this->parent->prettifyFieldName($field);
101 echo
"<label class='label' for='{$this->parent->id}_{$field}'>".$this->_getLabel($field,
false).
"</label>\n";
104 echo
"<label class='switch{$disable}'>";
105 echo
"<input id='{$this->parent->id}_{$field}' type='checkbox' class='checkbox' value='1' name='$field'";
106 if ($this->parent->data->get($field))
110 echo
" {$disable}{$onClick}> <span class='slider {$this->style}'></span>";
119 echo
"<td colspan='2'";
120 if ($this->parent->labelCSS) echo
" class='{$this->parent->labelCSS}'";
121 echo
"><input type='checkbox' value='1' name='$field:$mode'";
122 if ($this->parent->params->get($field, $mode))
127 echo $this->parent->prettifyFieldName($field);
128 echo
"</td>\n</tr>\n";
134 $this->hideLabel =
false;
137 echo $this->
format($field);
static format($value, $template="")
FieldRenderer is the abstract base class for all FieldRenderers.
_startField($field, $styles="")
Internal method to generate the starting HTML for the field (including the label)
_endField($field)
Internal method to generate the closing HTML for the field.
FieldRenderer($parent)
Constructor.
RequiredBoolean Validator.
Field renderer for boolean data fields.
renderField($field)
FieldRenderers must override this method to provide the HTML implementation of the control used to ed...
$onClick
Name of Javascript function to be called when checkbox is toggled.
addValidatorsToForm($field, $required=false)
This method is called by the AutoForm to add any default input validators that are required by the Fi...
ToggleFieldRenderer(&$parent, $ragged, $field=null, $label=null)
Create a new BooleanFieldRenderer.
renderSearchField($field, $mode="match")
FieldRenderers must override this method to provide the HTML implementation of the control displayed ...
$template
, alternative to readonly; field can be reenabled thru javascript