10 defined(
'JPATH_PLATFORM') or die;
29 protected $type =
'Number';
64 public function __get($name)
74 return parent::__get($name);
87 public function __set($name, $value)
94 $this->$name = (float) $value;
98 parent::__set($name, $value);
116 public function setup(SimpleXMLElement $element, $value, $group = null)
118 $return = parent::setup($element, $value, $group);
122 $this->max = isset($this->element[
'max']) ? (float) $this->element[
'max'] : 100;
123 $this->min = isset($this->element[
'min']) ? (float) $this->element[
'min'] : 0;
124 $this->step = isset($this->element[
'step']) ? (float) $this->element[
'step'] : 1;
137 protected function getInput()
140 $hint = $this->translateHint ?
JText::_($this->hint) : $this->hint;
143 $size = !empty($this->size) ?
' size="' . $this->size .
'"' :
'';
144 $max = !empty($this->max) ?
' max="' . $this->max .
'"' :
'';
145 $min = !empty($this->min) ?
' min="' . $this->min .
'"' :
'';
146 $step = !empty($this->step) ?
' step="' . $this->step .
'"' :
'';
147 $class = !empty($this->
class) ?
' class="' . $this->
class . '"' : '';
148 $readonly = $this->readonly ? ' readonly' : '';
149 $disabled = $this->disabled ? ' disabled' : '';
150 $required = $this->required ? ' required aria-required="true"' : '';
151 $hint = $hint ? ' placeholder="' . $hint . '"' : '';
153 $autocomplete = !$this->autocomplete ? ' autocomplete="off"' : ' autocomplete="' . $this->autocomplete . '"';
154 $autocomplete = $autocomplete == ' autocomplete="on"' ? '' : $autocomplete;
156 $autofocus = $this->autofocus ? ' autofocus' : '';
158 $value = (float) $this->value;
159 $value = empty($value) ? $this->min : $value;
162 $onchange = !empty($this->onchange) ? ' onchange="' . $this->onchange . '"' : '';
165 JHtml::_('jquery.framework');
166 JHtml::_('script', 'system/html5fallback.js', false, true);
168 return '<input type="number" name="' . $this->name . '" id="' . $this->id . '"' . ' value="'
169 . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '"' . $class . $size . $disabled . $readonly
170 . $hint . $onchange . $max . $step . $min . $required . $autocomplete . $autofocus . ' />';