1 | <?php |
||
9 | class CallToAction extends DataObject |
||
|
|||
10 | { |
||
11 | private static $db = [ |
||
12 | 'Title' => 'Varchar(100)', |
||
13 | 'Text' => 'Varchar(255)', |
||
14 | 'FontColour' => 'enum("white,black", "white")', |
||
15 | 'ImageFocusPoint' => 'enum("Centre,N,NW,W,SW,S,SE,E,NE", "Centre")', |
||
16 | 'CallToAction' => 'Varchar(50)', |
||
17 | 'VideoBackground' => 'Varchar(255)' |
||
18 | ]; |
||
19 | |||
20 | private static $has_one = [ |
||
21 | 'Image' => 'Image', |
||
22 | 'Link' => 'SiteTree' |
||
23 | ]; |
||
24 | |||
25 | private static $summary_fields = [ |
||
26 | 'Title' => 'Title', |
||
27 | 'Text' => 'Text', |
||
28 | 'Link.Title' => 'Link', |
||
29 | 'Image.CMSThumbNail' => 'Image' |
||
30 | ]; |
||
31 | |||
32 | private static $has_many = [ |
||
33 | 'Pages' => 'Page' |
||
34 | ]; |
||
35 | |||
36 | private static $default_sort = [ |
||
37 | 'Title' => 'ASC' |
||
38 | ]; |
||
39 | |||
40 | private static $singular_name = 'Call To Action'; |
||
41 | |||
42 | private static $plural_name = 'Calls To Action'; |
||
43 | |||
44 | private static $field_labels = [ |
||
45 | 'Title' => 'Title', |
||
46 | 'Text' => 'Text', |
||
47 | 'FontColour' => 'Text Colour', |
||
48 | 'ImageFocusPoint' => 'Focus Point', |
||
49 | 'CallToAction' => 'Call to Action', |
||
50 | 'Image' => 'Image', |
||
51 | 'Link' => 'Link' |
||
52 | ]; |
||
53 | |||
54 | private static $colour_font_options = [ |
||
55 | 'white' => 'white', |
||
56 | 'black' => 'black' |
||
57 | ]; |
||
58 | |||
59 | private static $field_labels_right = [ |
||
60 | 'Title' => 'A few words.', |
||
61 | 'Text' => 'A short sentence showing as the main text on the image.', |
||
62 | 'FontColour' => 'Text colour', |
||
63 | 'ImageFocusPoint' => 'What part of the image should be visible no matter what?', |
||
64 | 'Image' => 'Please ensure it is at least 2800px wide, but preferably a highly compressed image of 4800px wide', |
||
65 | 'CallToAction' => 'The text on the button - e.g. Sign Up Now (Optional)', |
||
66 | 'VideoBackground' => 'A link to a video anywhere on the internet. This takes priority over the image below.', |
||
67 | 'Link' => 'Optional link on button, if left blank users will simply scroll down.' |
||
68 | ]; |
||
69 | |||
70 | public function getCMSFields() |
||
115 | |||
116 | function CMSEditLink() |
||
120 | |||
121 | function CMSAddLink() |
||
125 | |||
126 | /** |
||
127 | * left top |
||
128 | */ |
||
129 | function BackgroundPosition() |
||
146 | } |
||
147 |
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.