Implement attachment CollectionType using stimulus

This commit is contained in:
Jan Böhmer 2022-08-03 20:28:27 +02:00
parent bf3dba0fb2
commit 8323f374a4
10 changed files with 141 additions and 231 deletions

View file

@ -95,9 +95,6 @@ class AttachmentFormType extends AbstractType
'label' => 'attachment.edit.attachment_type',
'class' => AttachmentType::class,
'disable_not_selectable' => true,
'attr' => [
'class' => 'attachment_type_selector',
],
]);
$builder->add('showInTable', CheckboxType::class, [
@ -139,9 +136,9 @@ class AttachmentFormType extends AbstractType
'mapped' => false,
'required' => false,
'attr' => [
'class' => 'file',
/*'class' => 'file',
'data-show-preview' => 'false',
'data-show-upload' => 'false',
'data-show-upload' => 'false',*/
],
'constraints' => [
//new AllowedFileExtension(),
@ -186,4 +183,9 @@ class AttachmentFormType extends AbstractType
'allow_builtins' => true,
]);
}
public function getBlockPrefix()
{
return 'attachment';
}
}

View file

@ -114,9 +114,11 @@ class StructuralEntityType extends AbstractType
$resolver->setDefault('empty_message', null);
$resolver->setDefault('controller', 'elements--selectpicker');
$resolver->setDefault('attr', static function (Options $options) {
$tmp = [
'data-controller' => 'elements--selectpicker',
'data-controller' => $options['controller'],
'data-live-search' => true,
'title' => 'selectpicker.nothing_selected',
];