1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Stfalcon\Bundle\SponsorBundle\Admin; |
4
|
|
|
|
5
|
|
|
use Sonata\AdminBundle\Admin\Admin; |
6
|
|
|
use Sonata\AdminBundle\Form\FormMapper; |
7
|
|
|
use Sonata\AdminBundle\Datagrid\ListMapper; |
8
|
|
|
use Stfalcon\Bundle\SponsorBundle\Entity\Sponsor; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* SponsorAdmin Class. |
12
|
|
|
*/ |
13
|
|
|
class SponsorAdmin extends Admin |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @return array|void |
17
|
|
|
*/ |
18
|
|
|
public function getBatchActions() |
19
|
|
|
{ |
20
|
|
|
$actions = []; |
|
|
|
|
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @param \Sonata\AdminBundle\Datagrid\ListMapper $listMapper |
25
|
|
|
*/ |
26
|
|
|
protected function configureListFields(ListMapper $listMapper) |
27
|
|
|
{ |
28
|
|
|
$listMapper |
29
|
|
|
->addIdentifier('name', null, ['label' => 'Название']) |
30
|
|
|
->add('site', null, ['label' => 'Сайт']) |
31
|
|
|
->add('sortOrder', null, ['label' => 'Номер сортировки']) |
32
|
|
|
->add('_action', 'actions', [ |
33
|
|
|
'label' => 'Действие', |
34
|
|
|
'actions' => [ |
35
|
|
|
'edit' => [], |
36
|
|
|
'delete' => [], |
37
|
|
|
], |
38
|
|
|
]); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @param \Sonata\AdminBundle\Form\FormMapper $formMapper |
43
|
|
|
*/ |
44
|
|
|
protected function configureFormFields(FormMapper $formMapper) |
45
|
|
|
{ |
46
|
|
|
/** @var Sponsor $subject */ |
47
|
|
|
$subject = $this->getSubject(); |
48
|
|
|
$formMapper |
49
|
|
|
->with('Общие') |
50
|
|
|
->add('name') |
51
|
|
|
->add('site', null, ['label' => 'Сайт']) |
52
|
|
|
->add( |
53
|
|
|
'file', |
54
|
|
|
'file', |
55
|
|
|
[ |
56
|
|
|
'label' => 'Логотип', |
57
|
|
|
'required' => false, |
58
|
|
|
'data_class' => 'Symfony\Component\HttpFoundation\File\File', |
59
|
|
|
'property_path' => 'file', |
60
|
|
|
'help' => $subject->getLogo() ? $subject->getLogo() : '', |
61
|
|
|
] |
62
|
|
|
) |
63
|
|
|
->add('sortOrder', null, ['attr' => ['min' => 1], 'label' => 'Номер сортировки']) |
64
|
|
|
->end() |
65
|
|
|
->with('События') |
66
|
|
|
->add( |
67
|
|
|
'sponsorEvents', |
68
|
|
|
'sonata_type_collection', |
69
|
|
|
[ |
70
|
|
|
'label' => 'Спонсируемые события', |
71
|
|
|
'by_reference' => false, |
72
|
|
|
], |
73
|
|
|
[ |
74
|
|
|
'edit' => 'inline', |
75
|
|
|
'inline' => 'table', |
76
|
|
|
] |
77
|
|
|
) |
78
|
|
|
->end(); |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|