{$values['type']}($values, $extras); } else { $result = $this->custom($values, $extras); } return $result; } protected function text(&$values, &$extras) { return ' '; } protected function file(&$values, &$extras) { return $this->text($values, $extras); } protected function password(&$values, &$extras) { return $this->text($values, $extras); } protected function hidden(&$values, &$extras) { $original = $values; $values = []; $values['type'] = $original['type']; $values['value'] = $original['value']; $values['name'] = $original['name']; $values['class'] = []; return $this->text($values, $extras); } protected function email(&$values, &$extras) { $values['class'][] = 'email-mask'; $values['type'] = 'text'; return $this->text($values, $extras); } protected function number(&$values, &$extras) { $values['class'][] = 'inputmask-decimal'; $values['value'] = !empty($values['value']) ? $values['value'] : 0; $decimals = true; if (isset($values['decimals'])) { if (is_numeric($values['decimals'])) { $decimals = $values['decimals']; } elseif (starts_with($values['decimals'], 'qta')) { $parts = explode('|', $values['decimals']); $values['min-value'] = isset($parts[1]) ? $parts[1] : 1; $decimals = \Settings::get('Cifre decimali per quantità'); $values['decimals'] = $decimals; } } $values['value'] = (\Translator::getEnglishFormatter()->isNumber($values['value'])) ? \Translator::numberToLocale($values['value'], $decimals) : $values['value']; $values['type'] = 'text'; return $this->text($values, $extras); } protected function custom(&$values, &$extras) { return ' |value|'; } protected function textarea(&$values, &$extras) { $values['class'][] = 'autosize'; return ' '; } }