44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Core\Form\FileManager;
|
|
|
|
use Symfony\Component\Form\AbstractType;
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
|
use Symfony\Component\Validator\Constraints\File;
|
|
use Symfony\Component\Validator\Constraints\All;
|
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
|
use Symfony\Component\Validator\Constraints\Regex;
|
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
|
|
|
class DirectoryCreateType extends AbstractType
|
|
{
|
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
{
|
|
$builder->add(
|
|
'name',
|
|
TextType::class,
|
|
[
|
|
'label' => 'Name',
|
|
'required' => true,
|
|
'attr' => [
|
|
],
|
|
'constraints' => [
|
|
new Regex([
|
|
'pattern' => '#['.preg_quote('\\/?%*:|"<>').'\t\n\r]+#',
|
|
'match' => false,
|
|
]),
|
|
new NotBlank(),
|
|
],
|
|
]
|
|
);
|
|
}
|
|
|
|
public function configureOptions(OptionsResolver $resolver)
|
|
{
|
|
$resolver->setDefaults([
|
|
]);
|
|
}
|
|
}
|