{$values['type']}($values, $extras); return $result; } protected function checkbox(&$values, &$extras) { unset($values['class'][0]); $values['value'] = (empty($values['value']) || $values['value'] == 'off') ? false : true; if (!empty($values['value']) && !in_array('checked', $extras)) { $extras[] = 'checked'; } if (in_array('readonly', $extras)) { $extras[] = 'disabled'; } $values['placeholder'] = (isset($values['placeholder'])) ? $values['placeholder'] : $values['label']; $result .= '
'; return $result; } protected function bootswitch(&$values, &$extras) { unset($values['class'][0]); $values['class'][] = 'bootstrap-switch'; $values['value'] = (empty($values['value']) || $values['value'] == 'off') ? false : true; if (!empty($values['value']) && !in_array('checked', $extras)) { $extras[] = 'checked'; } return '
'; } protected function radio(&$values, &$extras) { $result = ''; $originalExtras = $extras; $radios = json_decode('{'.$values['values'].'}', true); $values['value'] = !array_key_exists($values['value'], $radios) ? array_keys($radios)[0] : $values['value']; foreach ($radios as $key => $value) { $checked = false; if ($key === $values['value']) { $checked = true; } $result .= ' '; } return $result; } }