1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-18 02:41:27 +02:00

feat(admin-plugin): add text field #360

This commit is contained in:
Awilum
2020-02-08 12:15:31 +03:00
parent 9943e8b019
commit 74be6e5c87
2 changed files with 9 additions and 7 deletions

View File

@@ -548,15 +548,10 @@ class FormController extends Controller
$size = isset($properties['size']) ? $this->sizes[$properties['size']] : $this->sizes['12'];
$help = isset($properties['help']) ? $properties['help'] : '';
$id = isset($properties['id']) ? $properties['id'] : $field_id;
$name = isset($properties['name']) ? $properties['name'] : $field_name;
$class = isset($properties['class']) ? $properties['class'] : $this->field_class;
$field = '<div class="form-group ' . $size . '">';
$field .= ($title ? Form::label($field_id, __($title)) : '');
$field .= Form::input($field_name, $field_value, $attributes);
$field .= ($help ? '<small class="form-text text-muted">' . __($help) . '</small>' : '');
$field .= '</div>';
return $this->flextype['view']->fetch('plugins/form/templates/fields/text/field.html', ['title' => $title, 'size' => $size, 'name' => $name, 'id' => $id, 'class' => $class, 'help' => $help]);
}
/**

View File

@@ -0,0 +1,7 @@
<div class="form-group {{ size }}">
<label for="{{ id }}" class="form-control-title">{{ tr(title) }}</label>
<input type="text" id="{{ id }}" name="{{ id }}" value="" class="{{ class }}">
{% if help %}
<small>{{ help }}</small>
{% endif %}
</div>