From: Raphaƫl Gertz Date: Tue, 23 Feb 2021 23:25:16 +0000 (+0100) Subject: Add class, contact, donate, link and profile fields X-Git-Tag: 0.2.1~52 X-Git-Url: https://git.rapsys.eu/airbundle/commitdiff_plain/c49fd2c87a55bbd865ca22265e56255a0596c804?hp=e0db9e61378eec53227829137c931263ca095f4c Add class, contact, donate, link and profile fields --- diff --git a/Form/SnippetType.php b/Form/SnippetType.php index 9c21171..9c76ff4 100644 --- a/Form/SnippetType.php +++ b/Form/SnippetType.php @@ -5,10 +5,10 @@ namespace Rapsys\AirBundle\Form; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -#use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Symfony\Component\Form\Extension\Core\Type\UrlType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Validator\Constraints\NotBlank; use Rapsys\AirBundle\Form\Extension\Type\HiddenEntityType; @@ -26,8 +26,12 @@ class SnippetType extends AbstractType { ->add('location', HiddenEntityType::class, ['required' => true]) ->add('user', HiddenEntityType::class, ['required' => true]) ->add('description', TextareaType::class, ['attr' => ['placeholder' => 'Your description', 'cols' => 50, 'rows' => 15], 'constraints' => [new NotBlank(['message' => 'Please provide your description'])], 'required' => true]) + ->add('class', TextareaType::class, ['attr' => ['placeholder' => 'Your class', 'cols' => 50, 'rows' => 15], 'required' => false]) + ->add('contact', UrlType::class, ['attr' => ['placeholder' => 'Your contact'], 'required' => false]) + ->add('donate', UrlType::class, ['attr' => ['placeholder' => 'Your donate'], 'required' => false]) + ->add('link', UrlType::class, ['attr' => ['placeholder' => 'Your link'], 'required' => false]) + ->add('profile', UrlType::class, ['attr' => ['placeholder' => 'Your profile'], 'required' => false]) ->add('submit', SubmitType::class, ['label' => 'Send', 'attr' => ['class' => 'submit']]); - #->add('delete', SubmitType::class, ['label' => 'Remove', 'attr' => ['class' => 'submit']]); } /** @@ -41,8 +45,11 @@ class SnippetType extends AbstractType { /** * {@inheritdoc} - */ - public function getName() { - return 'snippet_form'; - } + * XXX: this doesn't work, because it's impossible to generate this same id on other side + * TODO: we would need to be able to generate this id at form creation + * + public function getBlockPrefix() { + //Prevent collision between instances with an unique block prefix + return 'snippet_'.uniqid(); + }*/ }