2lenet/crudit-bundle
Symfony bundle to rapidly build configurable CRUD back offices with SB Admin layout. Provides list views with pagination, sorting, actions, exports and batch ops, plus datasources, filters, menus, workflows, maps, markdown and Twig helpers.
The Lle\CruditBundle\Form\Type\AutocompleteType allows you to create a select for entities that is fed by an AJAX autocomplete. It is equivalent to Doctrine's EntityType.
Options :
| Name | Default | Description |
|---|---|---|
| class | required | a FQCN of your entity (e.g. App\Entity\Dummy) |
| multiple | false | set this to true if the field is a collection |
| route | null | if you want to customize the autocomplete route |
| url | null | if you want to customize the autocomplete url |
The Lle\CruditBundle\Form\Type\FileType allows you to create a file input with an interface to show or delete the current file.
Here's a working example:
$builder->add('documentFile', FileType::class, [
'allow_delete' => true,
'download_route' => 'app_crudit_entity_download', // Your own route to download the file
'image_route' => 'app_crudit_entity_downloadthumbnail', // Your own route to get the file (or the thumbnail)
]);
The Lle\CruditBundle\Form\Type\MarkdownType allows you to create a Markdown editor textarea.
The Lle\CruditBundle\Form\Type\CronExpressionType allows you to create a cron input with a interface to select value.
Crudit works with CollectionType, but you need to do configure some things on your side.
First, you need to include @LleCrudit/form/custom_types.html.twig in Twig templates:
twig:
form_themes:
- 'bootstrap_5_layout.html.twig'
- '[@LleCrudit](https://github.com/LleCrudit)/form/custom_types.html.twig'
Then you can use the CollectionType. Here's a working example:
// in parent form OrderType.php
$builder->add('lines', CollectionType::class, [
'label' => 'field.lines',
'entry_type' => LineType::class,
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
'prototype_name' => '__etape_name__', // not required unless you use multiple CollectionType
]);
// in subform LineType.php
$builder->add('ordre', ItemType::class, [
'label' => 'field.item',
'row_attr' => [
'class' => 'col-1',
]
]);
What matters :
How can I help you explore Laravel packages today?