n2ref / coreui-form-field-select2
CoreUI Form field select2
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:framework
pkg:composer/n2ref/coreui-form-field-select2
Requires
- php: >=8.0.0
- n2ref/coreui-form: ^1.0.4, dev-main
README
Install
composer install n2ref/coreui-form-field-select2-php
Select2 options
Example usage
$form = new Form(); $form->setRecord([ 'field' => 'Reactive', ]); $options = [ 'Reactive', 'Solution', 'Conglomeration', 'Algoritm', 'Holistic', ]; $form->setFields([ (new Field\Select2('field', 'title')))->setWidth(300)->setOptions($options) ->setSelect2([ "placeholder" => 'Write your value', "tags" => true, "tokenSeparators" => [',', ' '] ]), ]); echo json_encode($form->toArray());
Output
{
"component": "coreui.form",
"record" : {
"field": "Reactive"
},
"fields" : [
{
"type": "select2",
"name": "field",
"label": "title",
"width": 300,
"options": [
"Reactive", "Solution", "Conglomeration", "Algoritm", "Holistic"
],
"select2": {
"placeholder": "Write your value",
"tags": true,
"tokenSeparators": [",", " "]
}
}
]
}