|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace LAG\AdminBundle\Admin\Configuration; |
|
4
|
|
|
|
|
5
|
|
|
use LAG\AdminBundle\Application\Configuration\ApplicationConfiguration; |
|
6
|
|
|
use LAG\AdminBundle\Configuration\Configuration; |
|
7
|
|
|
use LAG\AdminBundle\Configuration\ConfigurationInterface; |
|
8
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Ease Admin configuration manipulation. |
|
12
|
|
|
*/ |
|
13
|
|
|
class AdminConfiguration extends Configuration implements ConfigurationInterface |
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* @var ApplicationConfiguration |
|
17
|
|
|
*/ |
|
18
|
|
|
protected $applicationConfiguration; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* AdminConfiguration constructor. |
|
22
|
|
|
* |
|
23
|
|
|
* @param ApplicationConfiguration $applicationConfiguration |
|
24
|
|
|
*/ |
|
25
|
17 |
|
public function __construct(ApplicationConfiguration $applicationConfiguration) |
|
26
|
|
|
{ |
|
27
|
17 |
|
parent::__construct(); |
|
28
|
|
|
|
|
29
|
17 |
|
$this->applicationConfiguration = $applicationConfiguration; |
|
30
|
17 |
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @param OptionsResolver $resolver |
|
34
|
|
|
*/ |
|
35
|
17 |
|
public function configureOptions(OptionsResolver $resolver) |
|
36
|
|
|
{ |
|
37
|
|
|
// inherited routing configuration from global application configuration |
|
38
|
17 |
|
$routing = $this |
|
39
|
|
|
->applicationConfiguration |
|
40
|
17 |
|
->getParameter('routing'); |
|
41
|
|
|
|
|
42
|
|
|
// inherited max per page configuration |
|
43
|
17 |
|
$maxPerPage = $this |
|
44
|
|
|
->applicationConfiguration |
|
45
|
17 |
|
->getParameter('max_per_page'); |
|
46
|
|
|
|
|
47
|
|
|
// optional options |
|
48
|
17 |
|
$resolver->setDefaults([ |
|
49
|
|
|
'actions' => [ |
|
50
|
17 |
|
'list' => [], |
|
51
|
17 |
|
'create' => [], |
|
52
|
17 |
|
'edit' => [], |
|
53
|
17 |
|
'delete' => [], |
|
54
|
17 |
|
], |
|
55
|
17 |
|
'batch' => true, |
|
56
|
17 |
|
'routing_url_pattern' => $routing['url_pattern'], |
|
57
|
17 |
|
'routing_name_pattern' => $routing['name_pattern'], |
|
58
|
17 |
|
'controller' => 'LAGAdminBundle:CRUD', |
|
59
|
17 |
|
'max_per_page' => $maxPerPage, |
|
60
|
17 |
|
'data_provider' => null, |
|
61
|
17 |
|
]); |
|
62
|
|
|
// required options |
|
63
|
17 |
|
$resolver->setRequired([ |
|
64
|
17 |
|
'entity', |
|
65
|
17 |
|
'form', |
|
66
|
17 |
|
]); |
|
67
|
17 |
|
} |
|
68
|
|
|
} |
|
69
|
|
|
|