mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-14 20:35:08 +02:00
Allow to specifiy a path to a builtin ressource via the url field.
This commit is contained in:
parent
d99365f906
commit
2001680542
6 changed files with 192 additions and 10 deletions
|
@ -37,6 +37,7 @@ use App\Entity\Attachments\AttachmentType;
|
|||
use App\Entity\Base\StructuralDBElement;
|
||||
use App\Form\Type\StructuralEntityType;
|
||||
use App\Services\AttachmentHelper;
|
||||
use App\Validator\Constraints\UrlOrBuiltin;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
||||
|
@ -75,11 +76,11 @@ class AttachmentFormType extends AbstractType
|
|||
'attr' => ['class' => 'form-control-sm'],
|
||||
'label_attr' => ['class' => 'checkbox-custom']]);
|
||||
|
||||
$builder->add('url', UrlType::class, [
|
||||
$builder->add('url', TextType::class, [
|
||||
'label' => $this->trans->trans('attachment.edit.url'),
|
||||
'required' => false,
|
||||
'constraints' => [
|
||||
new Url()
|
||||
$options['allow_builtins'] ? new UrlOrBuiltin() : new Url()
|
||||
]
|
||||
]);
|
||||
|
||||
|
@ -101,7 +102,8 @@ class AttachmentFormType extends AbstractType
|
|||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Attachment::class,
|
||||
'max_file_size' => '16M'
|
||||
'max_file_size' => '16M',
|
||||
'allow_builtins' => true
|
||||
]);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue