-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathProfileContactAddressType.php
56 lines (50 loc) · 1.41 KB
/
ProfileContactAddressType.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/*
* This file is part of Sulu.
*
* (c) MASSIVE ART WebServices GmbH
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Sulu\Bundle\CommunityBundle\Form\Type;
use Sulu\Bundle\ContactBundle\Entity\ContactAddress;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* Profile contact-address form.
*/
class ProfileContactAddressType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('address', $options['address_type'], $options['address_type_options']);
$builder->add('main', HiddenType::class, [
'required' => false,
'data' => 1,
]);
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(
[
'data_class' => ContactAddress::class,
'address_type' => ProfileAddressType::class,
'address_type_options' => ['label' => false],
'validation_groups' => ['profile'],
]
);
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'contact_address';
}
}