Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/n2ref/coreui-form-field-select2-php
https://github.com/n2ref/coreui-form-field-select2-php
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/n2ref/coreui-form-field-select2-php
- Owner: n2ref
- License: gpl-3.0
- Created: 2024-06-05T20:22:38.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-06-22T13:01:42.000Z (5 months ago)
- Last Synced: 2024-09-24T10:11:01.492Z (about 2 months ago)
- Language: PHP
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Coreui form field select2
[Online documentation](https://n2ref.github.io/coreui-form-field-select2)
[js repository](https://n2ref.github.io/coreui-form-field)
### Install
```shell
composer install n2ref/coreui-form-field-select2-php
```### Select2 options
[select2.org](https://select2.org)
### Example usage
```php
$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
```json
{
"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": [",", " "]
}
}
]
}
```