1
|
|
|
<?php |
2
|
|
|
class DatedUpdatePage extends Page { |
|
|
|
|
3
|
|
|
|
4
|
|
|
// Meant as an abstract base class. |
5
|
|
|
private static $hide_ancestor = 'DatedUpdatePage'; |
|
|
|
|
6
|
|
|
|
7
|
|
|
private static $singular_name = 'Dated Update Page'; |
|
|
|
|
8
|
|
|
|
9
|
|
|
private static $plural_name = 'Dated Update Pages'; |
|
|
|
|
10
|
|
|
|
11
|
|
|
private static $defaults = array( |
|
|
|
|
12
|
|
|
'ShowInMenus' => false |
13
|
|
|
); |
14
|
|
|
|
15
|
|
|
private static $db = array( |
|
|
|
|
16
|
|
|
'Abstract' => 'Text', |
17
|
|
|
'Date' => 'Datetime' |
18
|
|
|
); |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Add the default for the Date being the current day. |
22
|
|
|
*/ |
23
|
|
|
public function populateDefaults() { |
24
|
|
|
parent::populateDefaults(); |
25
|
|
|
|
26
|
|
View Code Duplication |
if(!isset($this->Date) || $this->Date === null) { |
|
|
|
|
27
|
|
|
$this->Date = SS_Datetime::now()->Format('Y-m-d 09:00:00'); |
|
|
|
|
28
|
|
|
} |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function fieldLabels($includerelations = true) { |
32
|
|
|
$labels = parent::fieldLabels($includerelations); |
33
|
|
|
$labels['Date'] = _t('DateUpdatePage.DateLabel', 'Date'); |
34
|
|
|
$labels['Abstract'] = _t('DateUpdatePage.AbstractTextFieldLabel', 'Abstract'); |
35
|
|
|
|
36
|
|
|
return $labels; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function getCMSFields() { |
40
|
|
|
$this->beforeUpdateCMSFields(function (FieldList $fields) { |
41
|
|
|
$fields->addFieldToTab( |
42
|
|
|
'Root.Main', |
43
|
|
|
$dateTimeField = DatetimeField::create('Date', $this->fieldLabel('Date')), |
44
|
|
|
'Content' |
45
|
|
|
); |
46
|
|
|
$dateTimeField->getDateField()->setConfig('showcalendar', true); |
47
|
|
|
|
48
|
|
|
$fields->addfieldToTab( |
49
|
|
|
'Root.Main', |
50
|
|
|
$abstractField = TextareaField::create('Abstract', $this->fieldLabel('Abstract')), |
51
|
|
|
'Content' |
52
|
|
|
); |
53
|
|
|
$abstractField->setAttribute('maxlength', '160'); |
54
|
|
|
$abstractField->setRightTitle( |
55
|
|
|
_t('DateUpdatePage.AbstractDesc','The abstract is used as a summary on the listing pages. It is limited to 160 characters.') |
56
|
|
|
); |
57
|
|
|
$abstractField->setRows(6); |
58
|
|
|
}); |
59
|
|
|
return parent::getCMSFields(); |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
class DatedUpdatePage_Controller extends Page_Controller { |
|
|
|
|
64
|
|
|
} |
65
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths