1 | <?php |
||
25 | class Widget extends DataObject |
||
26 | { |
||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | private static $db = array( |
||
31 | "Title" => "Varchar(255)", |
||
32 | "Sort" => "Int", |
||
33 | "Enabled" => "Boolean", |
||
34 | ); |
||
35 | |||
36 | /** |
||
37 | * @var array |
||
38 | */ |
||
39 | private static $defaults = array( |
||
40 | 'Enabled' => true, |
||
41 | ); |
||
42 | |||
43 | /** |
||
44 | * @var array |
||
45 | */ |
||
46 | private static $casting = array( |
||
47 | 'CMSTitle' => 'Text', |
||
48 | 'Description' => 'Text', |
||
49 | ); |
||
50 | |||
51 | private static $only_available_in = array(); |
||
52 | |||
53 | /** |
||
54 | * @var array |
||
55 | */ |
||
56 | private static $has_one = array( |
||
57 | "Parent" => WidgetArea::class, |
||
58 | ); |
||
59 | |||
60 | /** |
||
61 | * @var string |
||
62 | */ |
||
63 | private static $default_sort = "\"Sort\""; |
||
64 | |||
65 | /** |
||
66 | * @var string |
||
67 | */ |
||
68 | private static $title = "Widget Title"; |
||
69 | |||
70 | /** |
||
71 | * @var string |
||
72 | */ |
||
73 | private static $cmsTitle = "Name of this widget"; |
||
74 | |||
75 | /** |
||
76 | * @var string |
||
77 | */ |
||
78 | private static $description = "Description of what this widget does."; |
||
79 | |||
80 | /** |
||
81 | * @var array |
||
82 | */ |
||
83 | private static $summary_fields = array( |
||
84 | 'CMSTitle' => 'Title' |
||
85 | ); |
||
86 | |||
87 | /** |
||
88 | * @var string |
||
89 | */ |
||
90 | private static $table_name = 'Widget'; |
||
91 | |||
92 | /** |
||
93 | * @var WidgetController |
||
94 | */ |
||
95 | protected $controller; |
||
96 | |||
97 | public function populateDefaults() |
||
102 | |||
103 | /** |
||
104 | * Note: Overloaded in {@link WidgetController}. |
||
105 | * |
||
106 | * @return string HTML |
||
107 | */ |
||
108 | public function WidgetHolder() |
||
112 | |||
113 | /** |
||
114 | * Default way to render widget in templates. |
||
115 | * @return string HTML |
||
116 | */ |
||
117 | public function forTemplate($holder = true) |
||
125 | |||
126 | /** |
||
127 | * Renders the widget content in a custom template with the same name as the |
||
128 | * current class. This should be the main point of output customization. |
||
129 | * |
||
130 | * Invoked from within WidgetHolder.ss, which contains the "framing" around |
||
131 | * the custom content, like a title. |
||
132 | * |
||
133 | * Note: Overloaded in {@link WidgetController}. |
||
134 | * |
||
135 | * @return string HTML |
||
136 | */ |
||
137 | public function Content() |
||
141 | |||
142 | /** |
||
143 | * Get the frontend title for this widget |
||
144 | * |
||
145 | * @return string |
||
146 | */ |
||
147 | public function getTitle() |
||
152 | |||
153 | /** |
||
154 | * @return string |
||
155 | */ |
||
156 | public function getCMSTitle() |
||
160 | |||
161 | /** |
||
162 | * @return string |
||
163 | */ |
||
164 | public function getDescription() |
||
168 | |||
169 | /** |
||
170 | * @return string - HTML |
||
171 | */ |
||
172 | public function DescriptionSegment() |
||
176 | |||
177 | /** |
||
178 | * @see WidgetController::editablesegment() |
||
179 | * |
||
180 | * @return string - HTML |
||
181 | */ |
||
182 | public function EditableSegment() |
||
186 | |||
187 | /** |
||
188 | * @return FieldList |
||
189 | */ |
||
190 | public function getCMSFields() |
||
200 | |||
201 | /** |
||
202 | * @return FieldList |
||
203 | */ |
||
204 | public function CMSEditor() |
||
232 | |||
233 | /** |
||
234 | * A fully qualified class name is returned with underscores instead of backslashes so it is HTML safe. Dashes |
||
235 | * can't be used as they're handled in the Javascript for other purposes. |
||
236 | * |
||
237 | * @return string |
||
238 | */ |
||
239 | public function ClassName() |
||
243 | |||
244 | /** |
||
245 | * @return string |
||
246 | */ |
||
247 | public function Name() |
||
251 | |||
252 | /** |
||
253 | * @throws Exception |
||
254 | * |
||
255 | * @return WidgetController |
||
256 | */ |
||
257 | public function getController() |
||
278 | |||
279 | /** |
||
280 | * @param array $data |
||
281 | */ |
||
282 | public function populateFromPostData($data) |
||
310 | } |
||
311 |
This check marks private properties in classes that are never used. Those properties can be removed.