1 | <?php |
||
7 | class FormBlock extends Block |
||
8 | { |
||
9 | /** |
||
10 | * @var string |
||
11 | */ |
||
12 | private static $singular_name = 'Form Block'; |
||
13 | |||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | private static $plural_name = 'Form Blocks'; |
||
18 | |||
19 | /** |
||
20 | * @var array |
||
21 | */ |
||
22 | private static $db = array( |
||
23 | 'Content' => 'HTMLText', |
||
24 | ); |
||
25 | |||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | private static $has_one = array( |
||
30 | 'Form' => 'UserDefinedForm', |
||
31 | ); |
||
32 | |||
33 | /** |
||
34 | * @return FieldList |
||
35 | */ |
||
36 | 1 | public function getCMSFields() |
|
54 | |||
55 | /** |
||
56 | * @return Forms|HTMLText |
||
57 | */ |
||
58 | public function BlockForm() |
||
70 | |||
71 | /** |
||
72 | * @param null $member |
||
73 | * @return bool |
||
74 | */ |
||
75 | 1 | public function canCreate($member = null) |
|
82 | |||
83 | /** |
||
84 | * @param null $member |
||
85 | * @return bool |
||
86 | */ |
||
87 | 1 | public function canView($member = null) |
|
94 | } |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.