1 | <?php |
||
10 | class EditableLiteralField extends EditableFormField |
||
|
|||
11 | { |
||
12 | |||
13 | private static $singular_name = 'HTML Block'; |
||
14 | |||
15 | private static $plural_name = 'HTML Blocks'; |
||
16 | |||
17 | /** |
||
18 | * Mark as literal only |
||
19 | * |
||
20 | * @config |
||
21 | * @var bool |
||
22 | */ |
||
23 | private static $literal = true; |
||
24 | |||
25 | /** |
||
26 | * Get the name of the editor config to use for HTML sanitisation. Defaults to the active config. |
||
27 | * |
||
28 | * @var string |
||
29 | * @config |
||
30 | */ |
||
31 | private static $editor_config = null; |
||
32 | |||
33 | private static $db = array( |
||
34 | 'Content' => 'HTMLText', // From CustomSettings |
||
35 | 'HideFromReports' => 'Boolean(0)', // from CustomSettings |
||
36 | 'HideLabel' => 'Boolean(0)' |
||
37 | ); |
||
38 | |||
39 | private static $defaults = array( |
||
40 | 'HideFromReports' => false |
||
41 | ); |
||
42 | |||
43 | /** |
||
44 | * Returns the {@see HtmlEditorConfig} instance to use for sanitisation |
||
45 | * |
||
46 | * @return HtmlEditorConfig |
||
47 | */ |
||
48 | 1 | protected function getEditorConfig() |
|
56 | |||
57 | /** |
||
58 | * Safely sanitise html content, if enabled |
||
59 | * |
||
60 | * @param string $content Raw html |
||
61 | * @return string Safely sanitised html |
||
62 | */ |
||
63 | 4 | protected function sanitiseContent($content) |
|
76 | |||
77 | /** |
||
78 | * Get HTML Content of this literal field |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | 4 | public function getContent() |
|
88 | |||
89 | /** |
||
90 | * Set the content with the given value |
||
91 | * |
||
92 | * @param string $content |
||
93 | */ |
||
94 | 1 | public function setContent($content) |
|
100 | |||
101 | /** |
||
102 | * @return FieldList |
||
103 | */ |
||
104 | public function getCMSFields() |
||
126 | |||
127 | 1 | public function getFormField() |
|
143 | |||
144 | 1 | protected function updateFormField($field) |
|
154 | |||
155 | public function showInReports() |
||
159 | } |
||
160 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.