1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
*@author nicolaas[at] sunnysideup.co.nz |
4
|
|
|
*@description: individual FAQ page. Usually, these are not viewed as they can be read completely from the parent (FAQ HOLDER) page. |
5
|
|
|
*/ |
6
|
|
|
class FaqOnePage extends Page |
|
|
|
|
7
|
|
|
{ |
8
|
|
|
private static $icon = "mysite/images/treeicons/FaqOnePage"; |
|
|
|
|
9
|
|
|
|
10
|
|
|
private static $description = "Individual FAQ Page, displays the answer to one question"; |
|
|
|
|
11
|
|
|
|
12
|
|
|
private static $default_parent = 'FaqHolderPage'; |
|
|
|
|
13
|
|
|
|
14
|
|
|
private static $can_be_root = false; |
|
|
|
|
15
|
|
|
|
16
|
|
|
private static $allowed_children = "none"; |
|
|
|
|
17
|
|
|
|
18
|
|
|
private static $defaults = array( |
|
|
|
|
19
|
|
|
'ShowInMenus' => 0 |
20
|
|
|
); |
21
|
|
|
|
22
|
|
|
private static $has_one = array(); |
|
|
|
|
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Standard SS variable. |
26
|
|
|
*/ |
27
|
|
|
private static $singular_name = "FAQ Page"; |
|
|
|
|
28
|
|
|
public function i18n_singular_name() |
29
|
|
|
{ |
30
|
|
|
return _t("FAQPage.SINGULARNAME", "FAQ Page"); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Standard SS variable. |
35
|
|
|
*/ |
36
|
|
|
private static $plural_name = "FAQ Pages"; |
|
|
|
|
37
|
|
|
public function i18n_plural_name() |
38
|
|
|
{ |
39
|
|
|
return _t("FAQPage.PLURALNAME", "FAQ Pages"); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
//private static $has_many = array(); |
|
|
|
|
43
|
|
|
|
44
|
|
|
public function getCMSFields() |
|
|
|
|
45
|
|
|
{ |
46
|
|
|
$fields = parent::getCMSFields(); |
47
|
|
|
$fields->replaceField("Title", new TextField("Title", "Question")); |
48
|
|
|
$fields->replaceField("MenuTitle", new TextField("MenuTitle", "Question - short version for menus")); |
49
|
|
|
$fields->replaceField("Content", new HtmlEditorField("Content", "Answer")); |
50
|
|
|
return $fields; |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
class FaqOnePage_Controller extends Page_Controller |
|
|
|
|
55
|
|
|
{ |
56
|
|
|
public function init() |
57
|
|
|
{ |
58
|
|
|
parent::init(); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|
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.