1 | <?php |
||
3 | class CallToActionBlock extends Block |
||
4 | { |
||
5 | /** |
||
6 | * @return string |
||
7 | */ |
||
8 | 12 | public function singular_name() |
|
12 | |||
13 | /** |
||
14 | * @return string |
||
15 | */ |
||
16 | 1 | public function plural_name() |
|
17 | { |
||
18 | 1 | return _t('CallToActionBlock.PLURALNAME', 'Call To Action Blocks'); |
|
19 | } |
||
20 | |||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | private static $has_one = [ |
||
25 | 'BlockLink' => 'Link', |
||
26 | ]; |
||
27 | |||
28 | /** |
||
29 | * @return FieldList |
||
30 | */ |
||
31 | 1 | public function getCMSFields() |
|
48 | |||
49 | /** |
||
50 | * @return mixed |
||
51 | */ |
||
52 | 2 | public function getTitle() |
|
58 | } |
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: