1 | <?php |
||
21 | class SocialNetworkingLinksDataObject extends DataObject |
||
22 | { |
||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | private static $table_name = 'SocialNetworkingLinksDataObject'; |
||
|
|||
27 | |||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | private static $db = [ |
||
32 | 'URL' => 'Varchar(255)', |
||
33 | 'Title' => 'Varchar(255)', |
||
34 | 'Sort' => 'Int' |
||
35 | ]; |
||
36 | |||
37 | /** |
||
38 | * @var array |
||
39 | */ |
||
40 | private static $casting = [ |
||
41 | 'Code' => 'Varchar(255)', |
||
42 | 'Link' => 'Varchar(255)', |
||
43 | 'IconHTML' => 'HTMLText' |
||
44 | ]; |
||
45 | |||
46 | /** |
||
47 | * @var array |
||
48 | */ |
||
49 | private static $has_one = [ |
||
50 | 'Icon' => Image::class, |
||
51 | 'InternalLink' => Page::class |
||
52 | ]; |
||
53 | |||
54 | /** |
||
55 | * @var array |
||
56 | */ |
||
57 | private static $searchable_fields = [ |
||
58 | 'Title' => PartialMatchFilter::class |
||
59 | ]; |
||
60 | |||
61 | /** |
||
62 | * @return array |
||
63 | */ |
||
64 | private static $field_labels = [ |
||
65 | 'InternalLink' => 'Internal Link', |
||
66 | 'URL' => 'External Link (e.g. http://twitter.com/myname/) - will override internal link', |
||
67 | 'Title' => 'Title', |
||
68 | 'Sort' => 'Sort Index (lower numbers shown first)', |
||
69 | 'IconID' => 'Icon (preferably 32px X 32px)' |
||
70 | ]; |
||
71 | |||
72 | /** |
||
73 | * @var array |
||
74 | */ |
||
75 | private static $summary_fields = [ |
||
76 | 'Title' => 'Title', |
||
77 | 'IconHTML' => 'Icon' |
||
78 | ]; |
||
79 | |||
80 | /** |
||
81 | * @var string |
||
82 | */ |
||
83 | private static $default_sort = 'Sort ASC, Title ASC'; |
||
84 | |||
85 | /** |
||
86 | * @var string |
||
87 | */ |
||
88 | private static $singular_name = 'Join Us link'; |
||
89 | |||
90 | /** |
||
91 | * @var string |
||
92 | */ |
||
93 | private static $plural_name = 'Join Us links'; |
||
94 | |||
95 | /** |
||
96 | * @return boolean |
||
97 | */ |
||
98 | public function canView($member = null) |
||
102 | |||
103 | /** |
||
104 | * @return boolean |
||
105 | */ |
||
106 | public function canCreate($member = null, $context = []) |
||
110 | |||
111 | /** |
||
112 | * @return boolean |
||
113 | */ |
||
114 | public function canEdit($member = null) |
||
118 | |||
119 | /** |
||
120 | * @return boolean |
||
121 | */ |
||
122 | public function canDelete($member = null) |
||
126 | |||
127 | /** |
||
128 | * @return String - returns the title with all non-alphanumeric + spaces removed. |
||
129 | */ |
||
130 | public function Code() |
||
134 | |||
135 | /** |
||
136 | * @return DBField |
||
137 | */ |
||
138 | public function IconHTML() |
||
142 | |||
143 | /** |
||
144 | * @return DBField / icon |
||
145 | */ |
||
146 | public function getIconHTML() |
||
156 | |||
157 | /** |
||
158 | * Link |
||
159 | * |
||
160 | * @return string |
||
161 | */ |
||
162 | public function Link() |
||
173 | |||
174 | /** |
||
175 | * @return FieldList $fields |
||
176 | */ |
||
177 | public function getCMSFields() |
||
192 | } |
||
193 |