2016-02-16 12:49:25 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Wallabag\CoreBundle\Form\Type;
|
|
|
|
|
|
|
|
use Symfony\Component\Form\AbstractType;
|
|
|
|
use Symfony\Component\Form\CallbackTransformer;
|
|
|
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|
|
|
use Symfony\Component\Form\Extension\Core\Type\UrlType;
|
|
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
|
|
|
|
|
|
class ClientType extends AbstractType
|
|
|
|
{
|
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
|
|
{
|
|
|
|
$builder
|
2016-03-16 22:56:42 +00:00
|
|
|
->add('redirect_uris', UrlType::class, array('required' => true, 'label' => 'developer.client.form.redirect_uris_label'))
|
|
|
|
->add('save', SubmitType::class, array('label' => 'developer.client.form.save_label'))
|
2016-02-16 12:49:25 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
$builder->get('redirect_uris')
|
|
|
|
->addModelTransformer(new CallbackTransformer(
|
|
|
|
function ($originalUri) {
|
|
|
|
return $originalUri;
|
|
|
|
},
|
|
|
|
function ($submittedUri) {
|
|
|
|
return array($submittedUri);
|
|
|
|
}
|
|
|
|
))
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function configureOptions(OptionsResolver $resolver)
|
|
|
|
{
|
|
|
|
$resolver->setDefaults(array(
|
|
|
|
'data_class' => 'Wallabag\ApiBundle\Entity\Client',
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getBlockPrefix()
|
|
|
|
{
|
|
|
|
return 'client';
|
|
|
|
}
|
|
|
|
}
|