add doc for crud inline_form
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
7d96b229e1
commit
f61e4b3a44
1 changed files with 19 additions and 1 deletions
|
|
@ -108,10 +108,11 @@ All fields have these options:
|
|||
| `sort` | `array|callable` | `null` | Defines how to sort |
|
||||
| `href` | `string|callable` | `null` | Data to generate a link |
|
||||
| `href_attr` | `array|callable` | `null` | Attributes of the link |
|
||||
| `inline_form` | `null|callable` | `null` | A method to define a form to edit datas |
|
||||
|
||||
Examples:
|
||||
|
||||
```
|
||||
// Example #0
|
||||
$configuration->setField('index', 'My field', TextField::class, [
|
||||
'property' => 'myProperty',
|
||||
// OR
|
||||
|
|
@ -120,6 +121,7 @@ $configuration->setField('index', 'My field', TextField::class, [
|
|||
},
|
||||
])
|
||||
|
||||
// Example #1
|
||||
$configuration->setField('index', 'My field', TextField::class, [
|
||||
'raw' => true,
|
||||
'property_builder' => function($entity, array $options) {
|
||||
|
|
@ -127,6 +129,7 @@ $configuration->setField('index', 'My field', TextField::class, [
|
|||
},
|
||||
])
|
||||
|
||||
// Example #2
|
||||
// https://127.0.0.7:8000/admin/my_entity?_sort=property&_sort_direction=asc
|
||||
$configuration->setField('index', 'My field', TextField::class, [
|
||||
'property' => 'myProperty'
|
||||
|
|
@ -136,6 +139,21 @@ $configuration->setField('index', 'My field', TextField::class, [
|
|||
$query->orderBy('.myProperty', $direction);
|
||||
}],
|
||||
])
|
||||
|
||||
// Example #3
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
|
||||
$configuration->setField('index', 'My field', TextField::class, [
|
||||
'property' => 'myProperty',
|
||||
'inline_form' => function(FormBuilderInterface $builder, EntityInterface $entity) {
|
||||
$builder->add('myProperty', TextType::class, [
|
||||
'required' => true,
|
||||
'constraints' => [new NotBlank()],
|
||||
]);
|
||||
}
|
||||
])
|
||||
```
|
||||
|
||||
### TextField
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue