mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-11 19:04:31 +02:00
Allow to edit parameters for data structures.
This commit is contained in:
parent
4c63c88021
commit
ff05868051
16 changed files with 118 additions and 10 deletions
|
@ -45,7 +45,9 @@ namespace App\Form\AdminPages;
|
|||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Entity\Parameters\PartParameter;
|
||||
use App\Form\AttachmentFormType;
|
||||
use App\Form\ParameterType;
|
||||
use App\Form\Type\MasterPictureAttachmentType;
|
||||
use App\Form\Type\StructuralEntityType;
|
||||
use FOS\CKEditorBundle\Form\Type\CKEditorType;
|
||||
|
@ -74,8 +76,9 @@ class BaseEntityAdminForm extends AbstractType
|
|||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
parent::configureOptions($resolver); // TODO: Change the autogenerated stub
|
||||
parent::configureOptions($resolver);
|
||||
$resolver->setRequired('attachment_class');
|
||||
$resolver->setRequired('parameter_class');
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
|
@ -151,6 +154,18 @@ class BaseEntityAdminForm extends AbstractType
|
|||
'empty_data' => null,
|
||||
]);
|
||||
|
||||
$builder->add('parameters', CollectionType::class, [
|
||||
'entry_type' => ParameterType::class,
|
||||
'allow_add' => true,
|
||||
'allow_delete' => true,
|
||||
'label' => false,
|
||||
'by_reference' => false,
|
||||
'prototype_data' => new $options['parameter_class'],
|
||||
'entry_options' => [
|
||||
'data_class' => $options['parameter_class'],
|
||||
],
|
||||
]);
|
||||
|
||||
//Buttons
|
||||
$builder->add('save', SubmitType::class, [
|
||||
'label' => $is_new ? 'entity.create' : 'entity.edit.save',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue