1 | <?php |
||
3 | class PromoBlock extends Block |
||
4 | { |
||
5 | /** |
||
6 | * @return string |
||
7 | */ |
||
8 | 6 | public function singular_name() |
|
9 | { |
||
10 | 6 | return _t('PromoBlock.SINGULARNAME', 'Promo Block'); |
|
11 | } |
||
12 | |||
13 | /** |
||
14 | * @return string |
||
15 | */ |
||
16 | public function plural_name() |
||
20 | |||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | private static $many_many = array( |
||
25 | 'Promos' => 'PromoObject', |
||
26 | ); |
||
27 | |||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | private static $many_many_extraFields = array( |
||
32 | 'Promos' => array( |
||
33 | 'SortOrder' => 'Int', |
||
34 | ), |
||
35 | ); |
||
36 | |||
37 | /** |
||
38 | * @return FieldList |
||
39 | */ |
||
40 | 1 | public function getCMSFields() |
|
63 | |||
64 | /** |
||
65 | * @return mixed |
||
66 | */ |
||
67 | 1 | public function getPromoList() |
|
71 | |||
72 | /** |
||
73 | * @param null $member |
||
74 | * @return bool|null |
||
75 | */ |
||
76 | 1 | public function canCreate($member = null) |
|
90 | |||
91 | /** |
||
92 | * @param null $member |
||
93 | * @return bool|null |
||
94 | */ |
||
95 | public function canView($member = null) |
||
109 | } |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: