'; } /** * Rendert ein Zahlenfeld mit Buttons zum verstellen * * @param string $name * @param string $label * @param string $value * @return string */ function form_spinner($name, $label, $value) { $value = htmlspecialchars($value); return form_element($label, '
' . $title . ' | '; } $html .= '|
---|---|
' . sprintf( '', $dom_id, $name, $key, $sel ) . ' | '; } $html .= '
' . $text . '
', ''); } /** * Rendert den Absenden-Button eines Formulars * * @param string $name * @param string $label * @param string $class * @param bool $wrapForm * @param string $buttonType * @return string */ function form_submit($name, $label, $class = '', $wrapForm = true, $buttonType = 'primary') { $button = ''; if (!$wrapForm) { return $button; } return form_element( null, $button ); } /** * Rendert ein Formular-Textfeld * * @param string $name * @param string $label * @param string $value * @param bool $disabled * @param int|null $maxlength * @param string|null $autocomplete * * @return string */ function form_text($name, $label, $value, $disabled = false, $maxlength = null, $autocomplete = null) { $disabled = $disabled ? ' disabled="disabled"' : ''; $maxlength = $maxlength ? ' maxlength=' . (int)$maxlength : ''; $autocomplete = $autocomplete ? ' autocomplete="' . $autocomplete . '"' : ''; return form_element( $label, '', 'form_' . $name ); } /** * Renders a text input with placeholder instead of label. * * @param String $name Input name * @param String $placeholder Placeholder * @param String $value The value * @param Boolean $disabled Is the field enabled? * @return string */ function form_text_placeholder($name, $placeholder, $value, $disabled = false) { $disabled = $disabled ? ' disabled="disabled"' : ''; return form_element('', '' ); } /** * Rendert ein Formular-Emailfeld * * @param string $name * @param string $label * @param string $value * @param bool $disabled * @param string|null $autocomplete * @param int|null $maxlength * * @return string */ function form_email($name, $label, $value, $disabled = false, $autocomplete = null, $maxlength = null) { $disabled = $disabled ? ' disabled="disabled"' : ''; $autocomplete = $autocomplete ? ' autocomplete="' . $autocomplete . '"' : ''; $maxlength = $maxlength ? ' maxlength=' . (int)$maxlength : ''; return form_element( $label, '', 'form_' . $name ); } /** * Rendert ein Formular-Dateifeld * * @param string $name * @param string $label * @return string */ function form_file($name, $label) { return form_element( $label, sprintf('', $name), 'form_' . $name ); } /** * Rendert ein Formular-Passwortfeld * * @param string $name * @param string $label * @param bool $disabled * @return string */ function form_password($name, $label, $disabled = false) { $disabled = $disabled ? ' disabled="disabled"' : ''; return form_element( $label, sprintf( '', $name, config('min_password_length'), $disabled ), 'form_' . $name ); } /** * Renders a password input with placeholder instead of label. * * @param string $name * @param string $placeholder * @param bool $disabled * @return string */ function form_password_placeholder($name, $placeholder, $disabled = false) { $disabled = $disabled ? ' disabled="disabled"' : ''; return form_element( '', '', 'form_' . $name ); } /** * Rendert ein Formular-Textfeld * * @param string $name * @param string $label * @param string $value * @param bool $disabled * @return string */ function form_textarea($name, $label, $value, $disabled = false) { $disabled = $disabled ? ' disabled="disabled"' : ''; return form_element( $label, '', 'form_' . $name ); } /** * Rendert ein Formular-Auswahlfeld * * @param string $name * @param string $label * @param string[] $values * @param string $selected * @param string $selectText * @return string */ function form_select($name, $label, $values, $selected, $selectText = '') { return form_element( $label, html_select_key('form_' . $name, $name, $values, $selected, $selectText), 'form_' . $name ); } /** * Rendert ein Formular-Element * * @param string $label * @param string $input * @param string $for * @return string */ function form_element($label, $input, $for = '') { if (empty($label)) { return '