aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ApiBundle/Form
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-10-11 21:01:30 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-10-11 21:01:30 +0200
commite4cf672ccf61689ba28c2e89fc55f83167800b18 (patch)
tree5dc22c97797bdcdd0a3d2a7e182410f04a748c1e /src/Wallabag/ApiBundle/Form
parente57df5611fe82ce61a71d51c762ee9296f18c3ac (diff)
parentdbe94e73a9eaf3acb250812913b0303b35d01a2e (diff)
downloadwallabag-e4cf672ccf61689ba28c2e89fc55f83167800b18.tar.gz
wallabag-e4cf672ccf61689ba28c2e89fc55f83167800b18.tar.zst
wallabag-e4cf672ccf61689ba28c2e89fc55f83167800b18.zip
Merge remote-tracking branch 'origin/master' into 2.2
Diffstat (limited to 'src/Wallabag/ApiBundle/Form')
-rw-r--r--src/Wallabag/ApiBundle/Form/Type/ClientType.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/Wallabag/ApiBundle/Form/Type/ClientType.php b/src/Wallabag/ApiBundle/Form/Type/ClientType.php
new file mode 100644
index 00000000..0ea1a9c5
--- /dev/null
+++ b/src/Wallabag/ApiBundle/Form/Type/ClientType.php
@@ -0,0 +1,46 @@
1<?php
2
3namespace Wallabag\ApiBundle\Form\Type;
4
5use Symfony\Component\Form\AbstractType;
6use Symfony\Component\Form\CallbackTransformer;
7use Symfony\Component\Form\Extension\Core\Type\SubmitType;
8use Symfony\Component\Form\Extension\Core\Type\UrlType;
9use Symfony\Component\Form\Extension\Core\Type\TextType;
10use Symfony\Component\Form\FormBuilderInterface;
11use Symfony\Component\OptionsResolver\OptionsResolver;
12
13class ClientType extends AbstractType
14{
15 public function buildForm(FormBuilderInterface $builder, array $options)
16 {
17 $builder
18 ->add('name', TextType::class, ['label' => 'developer.client.form.name_label'])
19 ->add('redirect_uris', UrlType::class, ['required' => false, 'label' => 'developer.client.form.redirect_uris_label'])
20 ->add('save', SubmitType::class, ['label' => 'developer.client.form.save_label'])
21 ;
22
23 $builder->get('redirect_uris')
24 ->addModelTransformer(new CallbackTransformer(
25 function ($originalUri) {
26 return $originalUri;
27 },
28 function ($submittedUri) {
29 return [$submittedUri];
30 }
31 ))
32 ;
33 }
34
35 public function configureOptions(OptionsResolver $resolver)
36 {
37 $resolver->setDefaults([
38 'data_class' => 'Wallabag\ApiBundle\Entity\Client',
39 ]);
40 }
41
42 public function getBlockPrefix()
43 {
44 return 'client';
45 }
46}