mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-14 20:35:08 +02:00
Moved attachment form submit logic to a seperate service.
This commit is contained in:
parent
1f7c122ba2
commit
d382021fee
9 changed files with 279 additions and 73 deletions
|
@ -56,12 +56,15 @@ class AttachmentFormType extends AbstractType
|
|||
protected $attachment_helper;
|
||||
protected $trans;
|
||||
protected $urlGenerator;
|
||||
protected $allow_attachments_download;
|
||||
|
||||
public function __construct(AttachmentHelper $attachmentHelper, TranslatorInterface $trans, UrlGeneratorInterface $urlGenerator)
|
||||
public function __construct(AttachmentHelper $attachmentHelper, TranslatorInterface $trans,
|
||||
UrlGeneratorInterface $urlGenerator, bool $allow_attachments_downloads)
|
||||
{
|
||||
$this->attachment_helper = $attachmentHelper;
|
||||
$this->trans = $trans;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->allow_attachments_download = $allow_attachments_downloads;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
|
@ -94,6 +97,13 @@ class AttachmentFormType extends AbstractType
|
|||
]
|
||||
]);
|
||||
|
||||
$builder->add('downloadURL', CheckboxType::class, ['required' => false,
|
||||
'label' => $this->trans->trans('attachment.edit.download_url'),
|
||||
'mapped' => false,
|
||||
'disabled' => !$this->allow_attachments_download,
|
||||
'attr' => ['class' => 'form-control-sm'],
|
||||
'label_attr' => ['class' => 'checkbox-custom']]);
|
||||
|
||||
$builder->add('file', FileType::class, [
|
||||
'label' => $this->trans->trans('attachment.edit.file'),
|
||||
'mapped' => false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue