1 | <?php |
||
3 | class OnePageSlide extends DataExtension |
||
|
|||
4 | { |
||
5 | |||
6 | private static $db = array( |
||
7 | 'BackgroundColor' => 'Varchar', |
||
8 | 'HeadingColor' => 'Varchar', |
||
9 | 'TextColor' => 'Varchar', |
||
10 | 'AdditionalCSSClass' => 'Varchar' |
||
11 | ); |
||
12 | |||
13 | private static $has_one = array( |
||
14 | 'BackgroundImage' => 'Image' |
||
15 | ); |
||
16 | |||
17 | private static $background_color_palette = array( |
||
18 | '#fff', |
||
19 | '#444', |
||
20 | '#000' |
||
21 | ); |
||
22 | private static $heading_color_palette = array( |
||
23 | '#000', |
||
24 | '#fff' |
||
25 | ); |
||
26 | private static $text_color_palette = array( |
||
27 | '#000', |
||
28 | '#fff' |
||
29 | ); |
||
30 | |||
31 | /** |
||
32 | * limit the generated form fields to slides (direct children of a OnePageHolder) |
||
33 | * @var bool |
||
34 | */ |
||
35 | private static $use_only_on_onepage_slides = false; |
||
36 | |||
37 | /** |
||
38 | * do not require colors to be set |
||
39 | * @var bool |
||
40 | */ |
||
41 | private static $colors_can_be_empty = false; |
||
42 | |||
43 | /** |
||
44 | * @inheritdoc |
||
45 | */ |
||
46 | public function updateFieldLabels(&$labels) |
||
58 | |||
59 | |||
60 | /** |
||
61 | * @inheritdoc |
||
62 | */ |
||
63 | public function updateCMSFields(FieldList $fields) |
||
91 | |||
92 | protected function generateColorPalette($fieldName, $paletteSetting) |
||
110 | |||
111 | //@todo: if Parent is a OnePageHolder modify $Link to show to $Parent->Link() / #$URLSegment |
||
112 | //@todo: if Parent is a OnePageHolder disable ShowInMenus |
||
113 | //@todo: don't show slide in google sitempap |
||
114 | |||
115 | /** |
||
116 | * @todo: use customCSS? |
||
117 | * @return string |
||
118 | */ |
||
119 | public function getOnePageSlideStyle() |
||
135 | |||
136 | /** |
||
137 | * get's fired on ContentController::init() |
||
138 | * |
||
139 | * check if this is a OnePageSlide and redirect to parent if |
||
140 | * - controller has no action |
||
141 | * - request isn't an ajax request |
||
142 | */ |
||
143 | public function contentcontrollerInit(&$controller) |
||
164 | |||
165 | /** |
||
166 | * Udates RelativeLink() |
||
167 | * |
||
168 | * If no $action is given it changes /path/to/URLSegment into /path/to#URLSegment |
||
169 | * |
||
170 | * @param $base |
||
171 | * @param $action |
||
172 | */ |
||
173 | public function updateRelativeLink(&$base, &$action) |
||
191 | |||
192 | |||
193 | /** |
||
194 | * Checks, if the current page is a slide of a one-page by checking if the parent page is a OnePageHolder |
||
195 | * |
||
196 | * @return bool |
||
197 | */ |
||
198 | public function isOnePageSlide() |
||
202 | |||
203 | /** |
||
204 | * Checks if the current page is a nested one-page slide |
||
205 | * |
||
206 | * @return bool |
||
207 | */ |
||
208 | public function isNestedOnePageSlide() { |
||
213 | |||
214 | /** |
||
215 | * Helper to check if we're previewing the current page in CMS |
||
216 | * |
||
217 | * @return bool |
||
218 | */ |
||
219 | public function isCMSPreview() |
||
225 | |||
226 | /** |
||
227 | * renders the current page using the ClassName_onepage template, |
||
228 | * e.g. Page_onepage |
||
229 | * |
||
230 | * The suffix is generated by @link getOnePageTemplateSuffix |
||
231 | * |
||
232 | * @return HTMLText |
||
233 | */ |
||
234 | public function getOnePageContent() |
||
243 | |||
244 | |||
245 | /** |
||
246 | * Helper function to generate the template suffix for the current page. |
||
247 | * Calls page's "generateOnePageTemplateSuffix" method if it exists. |
||
248 | * This way your page can define the template suffix to be e.g. '_layout1_onepage' instead of just '_onepage' |
||
249 | * |
||
250 | * @return string |
||
251 | */ |
||
252 | public function getOnePageTemplateSuffix() |
||
258 | |||
259 | } |
||
260 |
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.