1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Kunstmaan\LeadGenerationBundle\AdminList; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\EntityManager; |
6
|
|
|
use Kunstmaan\AdminBundle\Helper\Security\Acl\AclHelper; |
7
|
|
|
use Kunstmaan\AdminListBundle\AdminList\Configurator\AbstractDoctrineORMAdminListConfigurator; |
8
|
|
|
use Kunstmaan\AdminListBundle\AdminList\FilterType\ORM; |
9
|
|
|
|
10
|
|
|
class PopupAdminListConfigurator extends AbstractDoctrineORMAdminListConfigurator |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* @param EntityManager $em The entity manager |
14
|
|
|
* @param AclHelper $aclHelper The acl helper |
|
|
|
|
15
|
|
|
*/ |
16
|
|
View Code Duplication |
public function __construct(EntityManager $em, AclHelper $aclHelper = null) |
|
|
|
|
17
|
|
|
{ |
18
|
|
|
parent::__construct($em, $aclHelper); |
19
|
|
|
|
20
|
|
|
$this->setListTemplate('@KunstmaanLeadGeneration/AdminList/popup-list.html.twig'); |
21
|
|
|
$this->setEditTemplate('@KunstmaanLeadGeneration/AdminList/popup-edit.html.twig'); |
22
|
|
|
$this->setAddTemplate('@KunstmaanLeadGeneration/AdminList/popup-edit.html.twig'); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Configure the visible columns |
27
|
|
|
*/ |
28
|
|
|
public function buildFields() |
29
|
|
|
{ |
30
|
|
|
$this->addField('id', 'kuma_lead_generation.popup.list.header.id', true); |
31
|
|
|
$this->addField('name', 'kuma_lead_generation.popup.list.header.name', true); |
32
|
|
|
$this->addField('classname', 'kuma_lead_generation.popup.list.header.type', false); |
33
|
|
|
$this->addField('htmlId', 'kuma_lead_generation.popup.list.header.html_id', true); |
34
|
|
|
$this->addField('ruleCount', 'kuma_lead_generation.popup.list.header.rule_count', false); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Build filters for admin list |
39
|
|
|
*/ |
40
|
|
|
public function buildFilters() |
41
|
|
|
{ |
42
|
|
|
$this->addFilter('name', new ORM\StringFilterType('name'), 'kuma_lead_generation.popup.list.filter.name'); |
43
|
|
|
$this->addFilter('htmlId', new ORM\StringFilterType('htmlId'), 'kuma_lead_generation.popup.list.filter.html_id'); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Get bundle name |
48
|
|
|
* |
49
|
|
|
* @return string |
50
|
|
|
*/ |
51
|
|
|
public function getBundleName() |
52
|
|
|
{ |
53
|
|
|
return 'KunstmaanLeadGenerationBundle'; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Get entity name |
58
|
|
|
* |
59
|
|
|
* @return string |
60
|
|
|
*/ |
61
|
|
|
public function getEntityName() |
62
|
|
|
{ |
63
|
|
|
return 'Popup\AbstractPopup'; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @param object|array $item |
68
|
|
|
* |
69
|
|
|
* @return bool |
70
|
|
|
*/ |
71
|
|
|
public function canEdit($item) |
72
|
|
|
{ |
73
|
|
|
return true; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Configure if it's possible to delete the given $item |
78
|
|
|
* |
79
|
|
|
* @param object|array $item |
80
|
|
|
* |
81
|
|
|
* @return bool |
82
|
|
|
*/ |
83
|
|
|
public function canDelete($item) |
84
|
|
|
{ |
85
|
|
|
return true; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Configure if it's possible to add new items |
90
|
|
|
* |
91
|
|
|
* @return bool |
92
|
|
|
*/ |
93
|
|
|
public function canAdd() |
94
|
|
|
{ |
95
|
|
|
return true; |
96
|
|
|
} |
97
|
|
|
} |
98
|
|
|
|
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.