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:
Jan Böhmer 2019-11-01 22:04:30 +01:00
parent 7a9c528d6d
commit 767ee59fb8
3 changed files with 23 additions and 0 deletions

View file

@ -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,

View file

@ -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;
}