Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/m-vo/contao-group-widget
Group widget for repeating sets of DCA fields
https://github.com/m-vo/contao-group-widget
Last synced: 4 days ago
JSON representation
Group widget for repeating sets of DCA fields
- Host: GitHub
- URL: https://github.com/m-vo/contao-group-widget
- Owner: m-vo
- Created: 2021-01-05T19:37:00.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-12-20T13:05:10.000Z (about 1 month ago)
- Last Synced: 2025-01-13T12:17:39.867Z (11 days ago)
- Language: PHP
- Size: 414 KB
- Stars: 24
- Watchers: 5
- Forks: 9
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# contao-group-widget
[![Latest version on packagist][icon-version]][packagist]
This Contao CMS extension provides an input type `group` that allows
repeatable groups of fields in the backend. The resulting data is either
stored as a serialized array or in a custom entity relationship (ORM).![](docs/widget.png)
#### Design decisions / Limitations
The group element widgets are still 'first class citizens' of the respective
DCA. Only their definition will be made on the fly. This way we're not messing
with the act of rendering and state of the displayed child widgets. As a
result, adding new elements via the *plus* button will submit the
current DCA form to add the new element.Visual reordering of elements is done via the CSS `order` property. This way
`iframes` can be kept alive (the DOM won't change) which is especially helpful
when dealing with components like the `tinyMCE` rich text editor.## Documentation
* [Data definition](docs/data-definition.md)
* Storage backends
- [Serialized storage](docs/storage/serialized-storage.md) (default)
- [Entity storage](docs/storage/entity-storage.md)
- [Extending](docs/storage/extending.md)## TLDR;
Just give me an example, ok?```php
$GLOBALS['TL_DCA']['tl_content']['fields']['my_group'] = [
'inputType' => 'group',
'palette' => ['amount', 'singleSRC', 'text'],
'fields' => [
'amount' => [ // additional field, defined inline
'inputType' => 'text',
'eval' => ['tl_class' => 'w50'],
],
'&singleSRC' => [ // let's change some properties of the existing field
'eval' => ['mandatory' => false],
]
],
// force at least 1, at max 5 elements
'min' => 1,
'max' => 5,
// disable ordering (on by default)
'order' => false,
// store serialized into a blob (default storage backend)
'sql' => [
'type' => 'blob',
'length' => \Doctrine\DBAL\Platforms\MySQLPlatform::LENGTH_LIMIT_BLOB,
'notnull' => false,
],
];
```[icon-version]: https://img.shields.io/packagist/v/mvo/contao-group-widget.svg?style=flat-square
[packagist]: https://packagist.org/packages/mvo/contao-group-widget