|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
*@author nicolaas[at] sunnysideup.co.nz |
|
4
|
|
|
*@description: individual ForSale page. Usually, these are not viewed as they can be read completely from the parent (ForSale HOLDER) page. |
|
5
|
|
|
*/ |
|
6
|
|
|
class ForSaleOnePage extends Page |
|
|
|
|
|
|
7
|
|
|
{ |
|
8
|
|
|
public static $icon = "mysite/images/treeicons/ForSaleOnePage"; |
|
9
|
|
|
|
|
10
|
|
|
public static $default_parent = 'ForSaleHolderPage'; |
|
11
|
|
|
|
|
12
|
|
|
public static $allowed_children = "none"; |
|
13
|
|
|
|
|
14
|
|
|
public static $db = array( |
|
15
|
|
|
"IntroText" => "Varchar(255)", |
|
16
|
|
|
"PriceDescription" => "Varchar(255)", |
|
17
|
|
|
"ContactDetails" => "HTMLText" |
|
18
|
|
|
); |
|
19
|
|
|
|
|
20
|
|
|
public static $has_one = array( |
|
21
|
|
|
"ProductImage" => "Image" |
|
22
|
|
|
); |
|
23
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
//static $has_many = array(); |
|
|
|
|
|
|
26
|
|
|
|
|
27
|
|
|
public function getCMSFields() |
|
|
|
|
|
|
28
|
|
|
{ |
|
29
|
|
|
$fields = parent::getCMSFields(); |
|
30
|
|
|
$fields->replaceField("Title", new TextField("Title", "Product Name")); |
|
31
|
|
|
$fields->replaceField("MenuTitle", new TextField("MenuTitle", "Product Name - short version for menus")); |
|
32
|
|
|
$fields->replaceField("Content", new HtmlEditorField("Content", "Product Description", $rows = 7, $cols = 7)); |
|
33
|
|
|
$fields->addFieldToTab("Root.Content.ProductInfo", new TextField("IntroText", "Intro Text")); |
|
34
|
|
|
$fields->addFieldToTab("Root.Content.ProductInfo", new TextField("PriceDescription", "Price Description")); |
|
35
|
|
|
$fields->addFieldToTab("Root.Content.ProductInfo", new HtmlEditorField("ContactDetails", "Contact Details", $rows = 7, $cols = 7)); |
|
36
|
|
|
$fields->addFieldToTab("Root.Content.ProductInfo", new ImageField("ProductImage", "Product Image")); |
|
37
|
|
|
return $fields; |
|
38
|
|
|
} |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
class ForSaleOnePage_Controller extends Page_Controller |
|
|
|
|
|
|
42
|
|
|
{ |
|
43
|
|
|
public function init() |
|
44
|
|
|
{ |
|
45
|
|
|
parent::init(); |
|
46
|
|
|
} |
|
47
|
|
|
} |
|
48
|
|
|
|
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.