1 | <?php |
||
45 | abstract class AbstractSection extends Content implements |
||
46 | HierarchicalInterface, |
||
47 | MetatagInterface, |
||
48 | RoutableInterface, |
||
49 | SearchableInterface, |
||
50 | SectionInterface |
||
51 | { |
||
52 | use HierarchicalTrait; |
||
53 | use MetatagTrait; |
||
54 | use RoutableTrait; |
||
55 | use SearchableTrait; |
||
56 | |||
57 | const TYPE_BLOCKS = 'charcoal/cms/section/blocks'; |
||
58 | const TYPE_CONTENT = 'charcoal/cms/section/content'; |
||
59 | const TYPE_EMPTY = 'charcoal/cms/section/empty'; |
||
60 | const TYPE_EXTERNAL = 'charcoal/cms/section/external'; |
||
61 | const DEFAULT_TYPE = self::TYPE_CONTENT; |
||
62 | |||
63 | /** |
||
64 | * @var string $sectionType |
||
65 | */ |
||
66 | private $sectionType = self::DEFAULT_TYPE; |
||
67 | |||
68 | /** |
||
69 | * @var TranslationString $title |
||
70 | */ |
||
71 | private $title; |
||
72 | /** |
||
73 | * @var TranslationString $subtitle |
||
74 | */ |
||
75 | private $subtitle; |
||
76 | /** |
||
77 | * @var TranslationString $content |
||
78 | */ |
||
79 | private $content; |
||
80 | |||
81 | /** |
||
82 | * @var TranslationString $image |
||
83 | */ |
||
84 | private $image; |
||
85 | |||
86 | /** |
||
87 | * @var mixed $templateIdent |
||
88 | */ |
||
89 | private $templateIdent; |
||
|
|||
90 | /** |
||
91 | * @var array $templateOptions |
||
92 | */ |
||
93 | private $templateOptions = []; |
||
94 | |||
95 | /** |
||
96 | * @var array $attachments |
||
97 | */ |
||
98 | private $attachments; |
||
99 | |||
100 | /** |
||
101 | * Generate a slug on preSave |
||
102 | * @see RoutableTrait |
||
103 | * @return parent::preSave |
||
104 | */ |
||
105 | public function preSave() |
||
111 | |||
112 | /** |
||
113 | * Generate a slug on preUpdate |
||
114 | * @see RoutableTrait |
||
115 | * @param array $properties Properties to update. |
||
116 | * @return parent::preUpdate |
||
117 | */ |
||
118 | public function preUpdate(array $properties = null) |
||
124 | |||
125 | /** |
||
126 | * @param string $sectionType The section type. |
||
127 | * @throws InvalidArgumentException If the section type is not a string or not a valid section type. |
||
128 | * @return SectionInterface Chainable |
||
129 | */ |
||
130 | public function setSectionType($sectionType) |
||
151 | |||
152 | /** |
||
153 | * @return string |
||
154 | */ |
||
155 | public function sectionType() |
||
159 | |||
160 | /** |
||
161 | * @param mixed $title The section title (localized). |
||
162 | * @return TranslationString |
||
163 | */ |
||
164 | public function setTitle($title) |
||
169 | |||
170 | /** |
||
171 | * @return TranslationString |
||
172 | */ |
||
173 | public function title() |
||
177 | |||
178 | /** |
||
179 | * @param mixed $subtitle The section subtitle (localized). |
||
180 | * @return Section Chainable |
||
181 | */ |
||
182 | public function setSubtitle($subtitle) |
||
187 | |||
188 | /** |
||
189 | * @return TranslationString |
||
190 | */ |
||
191 | public function subtitle() |
||
195 | |||
196 | /** |
||
197 | * @param mixed $content The section content (localized). |
||
198 | * @return Section Chainable |
||
199 | */ |
||
200 | public function setContent($content) |
||
205 | |||
206 | /** |
||
207 | * @return TranslationString |
||
208 | */ |
||
209 | public function content() |
||
213 | |||
214 | /** |
||
215 | * @param mixed $image The section main image (localized). |
||
216 | * @return Section Chainable |
||
217 | */ |
||
218 | public function setImage($image) |
||
223 | |||
224 | /** |
||
225 | * @return TranslationString |
||
226 | */ |
||
227 | public function image() |
||
231 | |||
232 | /** |
||
233 | * @param mixed $template The section template (ident). |
||
234 | * @return SectionInterface Chainable |
||
235 | */ |
||
236 | public function setTemplateIdent($template) |
||
241 | |||
242 | /** |
||
243 | * @return mixed |
||
244 | */ |
||
245 | public function templateIdent() |
||
253 | |||
254 | /** |
||
255 | * @param array|string $templateOptions Extra template options, if any. |
||
256 | * @return SectionInterface Chainable |
||
257 | */ |
||
258 | public function setTemplateOptions($templateOptions) |
||
263 | |||
264 | /** |
||
265 | * @return array |
||
266 | */ |
||
267 | public function templateOptions() |
||
275 | |||
276 | /** |
||
277 | * @param string $type Optional type. |
||
278 | * @return array |
||
279 | */ |
||
280 | public function attachments($type = null) |
||
293 | |||
294 | /** |
||
295 | * @return array |
||
296 | */ |
||
297 | public function loadAttachments() |
||
301 | |||
302 | /** |
||
303 | * HierarchicalTrait > loadChildren |
||
304 | * |
||
305 | * @return array |
||
306 | */ |
||
307 | public function loadChildren() |
||
330 | |||
331 | /** |
||
332 | * MetatagTrait > canonicalUrl |
||
333 | * |
||
334 | * @return string |
||
335 | * @todo |
||
336 | */ |
||
337 | public function canonicalUrl() |
||
341 | |||
342 | /** |
||
343 | * @return TranslationString |
||
344 | */ |
||
345 | public function defaultMetaTitle() |
||
349 | |||
350 | /** |
||
351 | * @return TranslationString |
||
352 | */ |
||
353 | public function defaultMetaDescription() |
||
357 | |||
358 | /** |
||
359 | * @return TranslationString |
||
360 | */ |
||
361 | public function defaultMetaImage() |
||
365 | } |
||
366 |