1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-17 02:24:05 +02:00

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

This commit is contained in:
Awilum
2020-02-08 11:52:51 +03:00
parent 8fc5e4a857
commit 9943e8b019
2 changed files with 9 additions and 14 deletions

View File

@@ -409,16 +409,10 @@ class FormController extends Controller
$title = isset($properties['title']) ? $properties['title'] : '';
$size = isset($properties['size']) ? $this->sizes[$properties['size']] : $this->sizes['12'];
$h = isset($properties['h']) ? $properties['h'] : 3;
$id = isset($properties['id']) ? $properties['id'] : $field_id;
$class = isset($properties['class']) ? $properties['class'] . 'text-3xl border-b border-black' : 'text-3xl border-b border-black';
$attributes = isset($properties['attributes']) ? $properties['attributes'] : [];
$attributes['id'] = isset($attributes['id']) ? $attributes['id'] : $field_id;
$attributes['class'] = isset($attributes['class']) ? $attributes['class'] . 'text-3xl border-b border-black' : 'text-3xl border-b border-black';
$field = '<div class="form-group ' . $size . '">';
$field .= Html::heading(__($title), $h, $attributes);
$field .= '</div>';
return $field;
return $this->flextype['view']->fetch('plugins/form/templates/fields/heading/field.html', ['title' => $title, 'size' => $size, 'h' => $h, 'id' => $id, 'class' => $class]);
}
/**
@@ -553,10 +547,8 @@ class FormController extends Controller
$title = isset($properties['title']) ? $properties['title'] : '';
$size = isset($properties['size']) ? $this->sizes[$properties['size']] : $this->sizes['12'];
$help = isset($properties['help']) ? $properties['help'] : '';
$attributes = isset($properties['attributes']) ? $properties['attributes'] : [];
$attributes['id'] = isset($attributes['id']) ? $attributes['id'] : $field_id;
$attributes['class'] = isset($attributes['class']) ? $attributes['class'] : $this->field_class;
$id = isset($properties['id']) ? $properties['id'] : $field_id;
$class = isset($properties['class']) ? $properties['class'] : $this->field_class;
$field = '<div class="form-group ' . $size . '">';
$field .= ($title ? Form::label($field_id, __($title)) : '');
@@ -564,7 +556,7 @@ class FormController extends Controller
$field .= ($help ? '<small class="form-text text-muted">' . __($help) . '</small>' : '');
$field .= '</div>';
return $field;
}
/**

View File

@@ -0,0 +1,3 @@
<div class="form-group {{ size }}">
<h{{ h }} id="{{ id }}" class="{{ class }}">{{ tr(title) }}</h{{ h }}>
</div>