mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-14 20:35:08 +02:00
Apply the filetype filter to accept attribute of file input.
This way only files are shown which match the current attachment type and the user knows directly which file types are allowed or not.
This commit is contained in:
parent
7a9c528d6d
commit
767ee59fb8
3 changed files with 23 additions and 0 deletions
|
@ -70,6 +70,7 @@ class AttachmentFormType extends AbstractType
|
|||
'label' => $this->trans->trans('attachment.edit.attachment_type'),
|
||||
'class' => AttachmentType::class,
|
||||
'disable_not_selectable' => true,
|
||||
'attr' => ['class' => 'attachment_type_selector']
|
||||
]);
|
||||
|
||||
$builder->add('showInTable', CheckboxType::class, ['required' => false,
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
namespace App\Form\Type;
|
||||
|
||||
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Base\StructuralDBElement;
|
||||
use App\Entity\Parts\Storelocation;
|
||||
use App\Repository\StructuralDBElementRepository;
|
||||
|
@ -114,6 +115,11 @@ class StructuralEntityType extends AbstractType
|
|||
if ($this->options['disable_not_selectable'] && $choice->isNotSelectable()) {
|
||||
$tmp += ['disabled' => 'disabled'];
|
||||
}
|
||||
|
||||
if ($choice instanceof AttachmentType) {
|
||||
$tmp += ['data-filetype_filter' => $choice->getFiletypeFilter()];
|
||||
}
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue