|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @author Rafał Muszyński <[email protected]> |
|
5
|
|
|
* @copyright 2013 Sourcefabric o.p.s. |
|
6
|
|
|
* @license http://www.gnu.org/licenses/gpl-3.0.txt |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace Newscoop\PaywallBundle\Form\Type; |
|
10
|
|
|
|
|
11
|
|
|
use Symfony\Component\Form\AbstractType; |
|
12
|
|
|
use Symfony\Component\Form\FormBuilderInterface; |
|
13
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
|
14
|
|
|
|
|
15
|
|
|
class SubscriptionEditType extends AbstractType |
|
16
|
|
|
{ |
|
17
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options) |
|
18
|
|
|
{ |
|
19
|
|
|
$builder |
|
20
|
|
|
->add('topay', 'money', array( |
|
21
|
|
|
'label' => 'paywall.manage.label.topay', |
|
22
|
|
|
'error_bubbling' => true, |
|
23
|
|
|
'invalid_message' => 'paywall.manage.error.topay', |
|
24
|
|
|
'required' => true, |
|
25
|
|
|
'currency' => false, |
|
26
|
|
|
)) |
|
27
|
|
|
->add('currency', null, array( |
|
28
|
|
|
'label' => 'paywall.step2.label.currency', |
|
29
|
|
|
'error_bubbling' => true, |
|
30
|
|
|
'invalid_message' => 'paywall.manage.error.currency', |
|
31
|
|
|
'required' => true, |
|
32
|
|
|
)) |
|
33
|
|
|
->add('type', 'choice', array( |
|
34
|
|
|
'label' => 'paywall.manage.label.paymenttype', |
|
35
|
|
|
'choices' => array( |
|
36
|
|
|
'P' => 'paywall.manage.label.paid', |
|
37
|
|
|
'PN' => 'paywall.manage.label.paidnow', |
|
38
|
|
|
'T' => 'paywall.manage.label.trial', |
|
39
|
|
|
), |
|
40
|
|
|
'required' => true, |
|
41
|
|
|
)); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function setDefaultOptions(OptionsResolverInterface $resolver) |
|
45
|
|
|
{ |
|
46
|
|
|
$resolver->setDefaults(array( |
|
47
|
|
|
'csrf_protection' => false, |
|
48
|
|
|
)); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function getName() |
|
52
|
|
|
{ |
|
53
|
|
|
return 'subscriptioneditForm'; |
|
54
|
|
|
} |
|
55
|
|
|
} |
|
56
|
|
|
|