public function input($name = '', $value = '', $extra = [])
{
if (is_array($name)) {
$extra = (array) $extra + $name;
$name = $extra['name'];
}
if ( ! is_array($extra)) {
$extra = [];
}
$extra['name'] = $extra['name'] ?: ($name ?: 'text');
$extra['value'] = $extra['value'] ?: $value;
$extra['id'] = $extra['id'] ?: __FUNCTION__ . '_' . ++$this->_ids[__FUNCTION__];
$extra['desc'] = $extra['desc'] ?: ucfirst(str_replace('_', '', $extra['name']));
$extra['type'] = $extra['type'] ?: 'text';
$extra['placeholder'] = $extra['placeholder'] ? t($extra['placeholder']) : $extra['desc'];
$extra['class'] = isset($extra['class']) ? $extra['class'] : $this->CLASS_INPUT;
if ($extra['class_add']) {
$extra['class'] = trim($extra['class'] . ' ' . $extra['class_add']);
}
$attrs_names = ['name', 'type', 'id', 'class', 'style', 'placeholder', 'value', 'data', 'size', 'maxlength', 'pattern', 'disabled', 'required', 'autocomplete', 'accept', 'target', 'autofocus', 'title', 'min', 'max', 'step', 'readonly'];
return '<input' . _attrs($extra, $attrs_names) . '>';
}