@@ -12,81 +12,81 @@ |
||
| 12 | 12 | |
| 13 | 13 | class EventPage extends DatedUpdatePage |
| 14 | 14 | { |
| 15 | - private static $description = 'Describes an event occurring on a specific date.'; |
|
| 16 | - |
|
| 17 | - private static $default_parent = EventHolder::class; |
|
| 18 | - |
|
| 19 | - private static $can_be_root = false; |
|
| 20 | - |
|
| 21 | - private static $icon_class = 'font-icon-p-event'; |
|
| 22 | - |
|
| 23 | - private static $singular_name = 'Event Page'; |
|
| 24 | - |
|
| 25 | - private static $plural_name = 'Event Pages'; |
|
| 26 | - |
|
| 27 | - private static $db = [ |
|
| 28 | - 'StartTime' => 'Time', |
|
| 29 | - 'EndTime' => 'Time', |
|
| 30 | - 'Location' => 'Text', |
|
| 31 | - ]; |
|
| 32 | - |
|
| 33 | - private static $table_name = 'EventPage'; |
|
| 34 | - |
|
| 35 | - public function fieldLabels($includerelations = true) |
|
| 36 | - { |
|
| 37 | - $labels = parent::fieldLabels($includerelations); |
|
| 38 | - $labels['StartTime'] = _t('CWP\\CWP\\PageTypes\\DateUpdatePage.StartTimeFieldLabel', 'Start Time'); |
|
| 39 | - $labels['EndTime'] = _t('CWP\\CWP\\PageTypes\\DateUpdatePage.EndTimeFieldLabel', 'End Time'); |
|
| 40 | - $labels['Location'] = _t('CWP\\CWP\\PageTypes\\DateUpdatePage.LocationFieldLabel', 'Location'); |
|
| 41 | - |
|
| 42 | - return $labels; |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * Add the default for the Date being the current day. |
|
| 47 | - */ |
|
| 48 | - public function populateDefaults() |
|
| 49 | - { |
|
| 50 | - if (!isset($this->Date) || $this->Date === null) { |
|
| 51 | - $this->Date = DBDatetime::now()->Format('y-MM-dd'); |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - if (!isset($this->StartTime) || $this->StartTime === null) { |
|
| 55 | - $this->StartTime = '09:00:00'; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - if (!isset($this->EndTime) || $this->EndTime === null) { |
|
| 59 | - $this->EndTime = '17:00:00'; |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - parent::populateDefaults(); |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - public function getCMSFields() |
|
| 66 | - { |
|
| 67 | - $this->beforeUpdateCMSFields(function (FieldList $fields) { |
|
| 68 | - $fields->removeByName('Date'); |
|
| 69 | - |
|
| 70 | - $dateTimeFields = array(); |
|
| 71 | - |
|
| 72 | - $dateTimeFields[] = $dateField = DateField::create('Date', 'Date'); |
|
| 73 | - $dateTimeFields[] = $startTimeField = TimeField::create( |
|
| 74 | - 'StartTime', |
|
| 75 | - $this->fieldLabel('StartTime') |
|
| 76 | - ); |
|
| 77 | - $dateTimeFields[] = $endTimeField = TimeField::create('EndTime', $this->fieldLabel('EndTime')); |
|
| 78 | - |
|
| 79 | - $fields->addFieldsToTab('Root.Main', [ |
|
| 80 | - $dateTimeField = FieldGroup::create('Date and time', $dateTimeFields), |
|
| 81 | - $locationField = TextareaField::create('Location', $this->fieldLabel('Location')) |
|
| 82 | - ], 'Abstract'); |
|
| 83 | - $locationField->setRows(4); |
|
| 84 | - }); |
|
| 85 | - return parent::getCMSFields(); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - public function NiceLocation() |
|
| 89 | - { |
|
| 90 | - return nl2br(Convert::raw2xml($this->Location), true); |
|
| 91 | - } |
|
| 15 | + private static $description = 'Describes an event occurring on a specific date.'; |
|
| 16 | + |
|
| 17 | + private static $default_parent = EventHolder::class; |
|
| 18 | + |
|
| 19 | + private static $can_be_root = false; |
|
| 20 | + |
|
| 21 | + private static $icon_class = 'font-icon-p-event'; |
|
| 22 | + |
|
| 23 | + private static $singular_name = 'Event Page'; |
|
| 24 | + |
|
| 25 | + private static $plural_name = 'Event Pages'; |
|
| 26 | + |
|
| 27 | + private static $db = [ |
|
| 28 | + 'StartTime' => 'Time', |
|
| 29 | + 'EndTime' => 'Time', |
|
| 30 | + 'Location' => 'Text', |
|
| 31 | + ]; |
|
| 32 | + |
|
| 33 | + private static $table_name = 'EventPage'; |
|
| 34 | + |
|
| 35 | + public function fieldLabels($includerelations = true) |
|
| 36 | + { |
|
| 37 | + $labels = parent::fieldLabels($includerelations); |
|
| 38 | + $labels['StartTime'] = _t('CWP\\CWP\\PageTypes\\DateUpdatePage.StartTimeFieldLabel', 'Start Time'); |
|
| 39 | + $labels['EndTime'] = _t('CWP\\CWP\\PageTypes\\DateUpdatePage.EndTimeFieldLabel', 'End Time'); |
|
| 40 | + $labels['Location'] = _t('CWP\\CWP\\PageTypes\\DateUpdatePage.LocationFieldLabel', 'Location'); |
|
| 41 | + |
|
| 42 | + return $labels; |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * Add the default for the Date being the current day. |
|
| 47 | + */ |
|
| 48 | + public function populateDefaults() |
|
| 49 | + { |
|
| 50 | + if (!isset($this->Date) || $this->Date === null) { |
|
| 51 | + $this->Date = DBDatetime::now()->Format('y-MM-dd'); |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + if (!isset($this->StartTime) || $this->StartTime === null) { |
|
| 55 | + $this->StartTime = '09:00:00'; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + if (!isset($this->EndTime) || $this->EndTime === null) { |
|
| 59 | + $this->EndTime = '17:00:00'; |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + parent::populateDefaults(); |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + public function getCMSFields() |
|
| 66 | + { |
|
| 67 | + $this->beforeUpdateCMSFields(function (FieldList $fields) { |
|
| 68 | + $fields->removeByName('Date'); |
|
| 69 | + |
|
| 70 | + $dateTimeFields = array(); |
|
| 71 | + |
|
| 72 | + $dateTimeFields[] = $dateField = DateField::create('Date', 'Date'); |
|
| 73 | + $dateTimeFields[] = $startTimeField = TimeField::create( |
|
| 74 | + 'StartTime', |
|
| 75 | + $this->fieldLabel('StartTime') |
|
| 76 | + ); |
|
| 77 | + $dateTimeFields[] = $endTimeField = TimeField::create('EndTime', $this->fieldLabel('EndTime')); |
|
| 78 | + |
|
| 79 | + $fields->addFieldsToTab('Root.Main', [ |
|
| 80 | + $dateTimeField = FieldGroup::create('Date and time', $dateTimeFields), |
|
| 81 | + $locationField = TextareaField::create('Location', $this->fieldLabel('Location')) |
|
| 82 | + ], 'Abstract'); |
|
| 83 | + $locationField->setRows(4); |
|
| 84 | + }); |
|
| 85 | + return parent::getCMSFields(); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + public function NiceLocation() |
|
| 89 | + { |
|
| 90 | + return nl2br(Convert::raw2xml($this->Location), true); |
|
| 91 | + } |
|
| 92 | 92 | } |
@@ -26,137 +26,137 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | class BaseHomePage extends Page |
| 28 | 28 | { |
| 29 | - private static $icon_class = 'font-icon-p-home'; |
|
| 30 | - |
|
| 31 | - private static $hide_ancestor = BaseHomePage::class; |
|
| 32 | - |
|
| 33 | - private static $singular_name = 'Home Page'; |
|
| 34 | - |
|
| 35 | - private static $plural_name = 'Home Pages'; |
|
| 36 | - |
|
| 37 | - private static $table_name = 'BaseHomePage'; |
|
| 38 | - |
|
| 39 | - private static $db = [ |
|
| 40 | - 'FeatureOneTitle' => 'Varchar(255)', |
|
| 41 | - 'FeatureOneCategory' => "Enum('bell,comments,film,flag,globe,group,list,phone,rss,time,user','comments')", |
|
| 42 | - 'FeatureOneContent' => 'HTMLText', |
|
| 43 | - 'FeatureOneButtonText' => 'Varchar(255)', |
|
| 44 | - 'FeatureTwoTitle' => 'Varchar(255)', |
|
| 45 | - 'FeatureTwoCategory' => "Enum('bell,comments,film,flag,globe,group,list,phone,rss,time,user','comments')", |
|
| 46 | - 'FeatureTwoContent' => 'HTMLText', |
|
| 47 | - 'FeatureTwoButtonText' => 'Varchar(255)' |
|
| 48 | - ]; |
|
| 49 | - |
|
| 50 | - private static $has_one = [ |
|
| 51 | - 'LearnMorePage' => SiteTree::class, |
|
| 52 | - 'FeatureOneLink' => SiteTree::class, |
|
| 53 | - 'FeatureTwoLink' => SiteTree::class, |
|
| 54 | - ]; |
|
| 55 | - |
|
| 56 | - private static $has_many = [ |
|
| 57 | - 'Quicklinks' => Quicklink::class . '.Parent', |
|
| 58 | - ]; |
|
| 59 | - |
|
| 60 | - public function Quicklinks() |
|
| 61 | - { |
|
| 62 | - return $this->getComponents('Quicklinks')->sort('SortOrder'); |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - public function getCMSFields() |
|
| 66 | - { |
|
| 67 | - $this->beforeUpdateCMSFields(function (FieldList $fields) { |
|
| 68 | - // Main Content tab |
|
| 69 | - $fields->addFieldToTab( |
|
| 70 | - 'Root.Main', |
|
| 71 | - TreeDropdownField::create( |
|
| 72 | - 'LearnMorePageID', |
|
| 73 | - _t(__CLASS__ . '.LearnMoreLink', 'Page to link the "Learn More" button to:'), |
|
| 74 | - SiteTree::class |
|
| 75 | - ), |
|
| 76 | - 'Metadata' |
|
| 77 | - ); |
|
| 78 | - |
|
| 79 | - $gridField = GridField::create( |
|
| 80 | - 'Quicklinks', |
|
| 81 | - 'Quicklinks', |
|
| 82 | - $this->Quicklinks(), |
|
| 83 | - GridFieldConfig_RelationEditor::create() |
|
| 84 | - ); |
|
| 85 | - $gridConfig = $gridField->getConfig(); |
|
| 86 | - $gridConfig->getComponentByType(GridFieldAddNewButton::class)->setButtonName( |
|
| 87 | - _t(__CLASS__ . '.AddNewButton', 'Add new') |
|
| 88 | - ); |
|
| 89 | - |
|
| 90 | - $injector = Injector::inst(); |
|
| 91 | - |
|
| 92 | - $gridConfig->removeComponentsByType(GridFieldAddExistingAutocompleter::class); |
|
| 93 | - $gridConfig->removeComponentsByType(GridFieldDeleteAction::class); |
|
| 94 | - $gridConfig->addComponent($injector->create(GridFieldDeleteAction::class)); |
|
| 95 | - $gridConfig->addComponent($injector->create(GridFieldOrderableRows::class, 'SortOrder')); |
|
| 96 | - $gridField->setModelClass(Quicklink::class); |
|
| 97 | - |
|
| 98 | - $fields->addFieldToTab('Root.Quicklinks', $gridField); |
|
| 99 | - |
|
| 100 | - $fields->removeByName('Import'); |
|
| 101 | - |
|
| 102 | - $fields->addFieldToTab( |
|
| 103 | - 'Root.Features', |
|
| 104 | - ToggleCompositeField::create( |
|
| 105 | - 'FeatureOne', |
|
| 106 | - _t(__CLASS__ . '.FeatureOne', 'Feature One'), |
|
| 107 | - array( |
|
| 108 | - TextField::create('FeatureOneTitle', _t(__CLASS__ . '.Title', 'Title')), |
|
| 109 | - $dropdownField = DropdownField::create( |
|
| 110 | - 'FeatureOneCategory', |
|
| 111 | - _t(__CLASS__ . '.FeatureCategoryDropdown', 'Category icon'), |
|
| 112 | - singleton(BaseHomePage::class)->dbObject('FeatureOneCategory')->enumValues() |
|
| 113 | - ), |
|
| 114 | - HTMLEditorField::create( |
|
| 115 | - 'FeatureOneContent', |
|
| 116 | - _t(__CLASS__ . '.FeatureContentFieldLabel', 'Content') |
|
| 117 | - ), |
|
| 118 | - TextField::create( |
|
| 119 | - 'FeatureOneButtonText', |
|
| 120 | - _t(__CLASS__ . '.FeatureButtonText', 'Button text') |
|
| 121 | - ), |
|
| 122 | - TreeDropdownField::create( |
|
| 123 | - 'FeatureOneLinkID', |
|
| 124 | - _t(__CLASS__ . '.FeatureLink', 'Page to link to'), |
|
| 125 | - SiteTree::class |
|
| 126 | - )->setDescription(_t(__CLASS__ . '.ButtonTextRequired', 'Button text must be filled in')) |
|
| 127 | - ) |
|
| 128 | - )->setHeadingLevel(3) |
|
| 129 | - ); |
|
| 130 | - $dropdownField->setEmptyString('none'); |
|
| 131 | - |
|
| 132 | - $fields->addFieldToTab('Root.Features', ToggleCompositeField::create( |
|
| 133 | - 'FeatureTwo', |
|
| 134 | - _t(__CLASS__ . '.FeatureTwo', 'Feature Two'), |
|
| 135 | - array( |
|
| 136 | - TextField::create('FeatureTwoTitle', _t(__CLASS__ . '.Title', 'Title')), |
|
| 137 | - $dropdownField = DropdownField::create( |
|
| 138 | - 'FeatureTwoCategory', |
|
| 139 | - _t(__CLASS__ . '.FeatureCategoryDropdown', 'Category icon'), |
|
| 140 | - singleton(BaseHomePage::class)->dbObject('FeatureTwoCategory')->enumValues() |
|
| 141 | - ), |
|
| 142 | - HTMLEditorField::create( |
|
| 143 | - 'FeatureTwoContent', |
|
| 144 | - _t(__CLASS__ . '.FeatureContentFieldLabel', 'Content') |
|
| 145 | - ), |
|
| 146 | - TextField::create( |
|
| 147 | - 'FeatureTwoButtonText', |
|
| 148 | - _t(__CLASS__ . '.FeatureButtonText', 'Button text') |
|
| 149 | - ), |
|
| 150 | - TreeDropdownField::create( |
|
| 151 | - 'FeatureTwoLinkID', |
|
| 152 | - _t(__CLASS__ . '.FeatureLink', 'Page to link to'), |
|
| 153 | - SiteTree::class |
|
| 154 | - )->setDescription(_t(__CLASS__ . '.ButtonTextRequired', 'Button text must be filled in')) |
|
| 155 | - ) |
|
| 156 | - )->setHeadingLevel(3)); |
|
| 157 | - $dropdownField->setEmptyString('none'); |
|
| 158 | - }); |
|
| 159 | - |
|
| 160 | - return parent::getCMSFields(); |
|
| 161 | - } |
|
| 29 | + private static $icon_class = 'font-icon-p-home'; |
|
| 30 | + |
|
| 31 | + private static $hide_ancestor = BaseHomePage::class; |
|
| 32 | + |
|
| 33 | + private static $singular_name = 'Home Page'; |
|
| 34 | + |
|
| 35 | + private static $plural_name = 'Home Pages'; |
|
| 36 | + |
|
| 37 | + private static $table_name = 'BaseHomePage'; |
|
| 38 | + |
|
| 39 | + private static $db = [ |
|
| 40 | + 'FeatureOneTitle' => 'Varchar(255)', |
|
| 41 | + 'FeatureOneCategory' => "Enum('bell,comments,film,flag,globe,group,list,phone,rss,time,user','comments')", |
|
| 42 | + 'FeatureOneContent' => 'HTMLText', |
|
| 43 | + 'FeatureOneButtonText' => 'Varchar(255)', |
|
| 44 | + 'FeatureTwoTitle' => 'Varchar(255)', |
|
| 45 | + 'FeatureTwoCategory' => "Enum('bell,comments,film,flag,globe,group,list,phone,rss,time,user','comments')", |
|
| 46 | + 'FeatureTwoContent' => 'HTMLText', |
|
| 47 | + 'FeatureTwoButtonText' => 'Varchar(255)' |
|
| 48 | + ]; |
|
| 49 | + |
|
| 50 | + private static $has_one = [ |
|
| 51 | + 'LearnMorePage' => SiteTree::class, |
|
| 52 | + 'FeatureOneLink' => SiteTree::class, |
|
| 53 | + 'FeatureTwoLink' => SiteTree::class, |
|
| 54 | + ]; |
|
| 55 | + |
|
| 56 | + private static $has_many = [ |
|
| 57 | + 'Quicklinks' => Quicklink::class . '.Parent', |
|
| 58 | + ]; |
|
| 59 | + |
|
| 60 | + public function Quicklinks() |
|
| 61 | + { |
|
| 62 | + return $this->getComponents('Quicklinks')->sort('SortOrder'); |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + public function getCMSFields() |
|
| 66 | + { |
|
| 67 | + $this->beforeUpdateCMSFields(function (FieldList $fields) { |
|
| 68 | + // Main Content tab |
|
| 69 | + $fields->addFieldToTab( |
|
| 70 | + 'Root.Main', |
|
| 71 | + TreeDropdownField::create( |
|
| 72 | + 'LearnMorePageID', |
|
| 73 | + _t(__CLASS__ . '.LearnMoreLink', 'Page to link the "Learn More" button to:'), |
|
| 74 | + SiteTree::class |
|
| 75 | + ), |
|
| 76 | + 'Metadata' |
|
| 77 | + ); |
|
| 78 | + |
|
| 79 | + $gridField = GridField::create( |
|
| 80 | + 'Quicklinks', |
|
| 81 | + 'Quicklinks', |
|
| 82 | + $this->Quicklinks(), |
|
| 83 | + GridFieldConfig_RelationEditor::create() |
|
| 84 | + ); |
|
| 85 | + $gridConfig = $gridField->getConfig(); |
|
| 86 | + $gridConfig->getComponentByType(GridFieldAddNewButton::class)->setButtonName( |
|
| 87 | + _t(__CLASS__ . '.AddNewButton', 'Add new') |
|
| 88 | + ); |
|
| 89 | + |
|
| 90 | + $injector = Injector::inst(); |
|
| 91 | + |
|
| 92 | + $gridConfig->removeComponentsByType(GridFieldAddExistingAutocompleter::class); |
|
| 93 | + $gridConfig->removeComponentsByType(GridFieldDeleteAction::class); |
|
| 94 | + $gridConfig->addComponent($injector->create(GridFieldDeleteAction::class)); |
|
| 95 | + $gridConfig->addComponent($injector->create(GridFieldOrderableRows::class, 'SortOrder')); |
|
| 96 | + $gridField->setModelClass(Quicklink::class); |
|
| 97 | + |
|
| 98 | + $fields->addFieldToTab('Root.Quicklinks', $gridField); |
|
| 99 | + |
|
| 100 | + $fields->removeByName('Import'); |
|
| 101 | + |
|
| 102 | + $fields->addFieldToTab( |
|
| 103 | + 'Root.Features', |
|
| 104 | + ToggleCompositeField::create( |
|
| 105 | + 'FeatureOne', |
|
| 106 | + _t(__CLASS__ . '.FeatureOne', 'Feature One'), |
|
| 107 | + array( |
|
| 108 | + TextField::create('FeatureOneTitle', _t(__CLASS__ . '.Title', 'Title')), |
|
| 109 | + $dropdownField = DropdownField::create( |
|
| 110 | + 'FeatureOneCategory', |
|
| 111 | + _t(__CLASS__ . '.FeatureCategoryDropdown', 'Category icon'), |
|
| 112 | + singleton(BaseHomePage::class)->dbObject('FeatureOneCategory')->enumValues() |
|
| 113 | + ), |
|
| 114 | + HTMLEditorField::create( |
|
| 115 | + 'FeatureOneContent', |
|
| 116 | + _t(__CLASS__ . '.FeatureContentFieldLabel', 'Content') |
|
| 117 | + ), |
|
| 118 | + TextField::create( |
|
| 119 | + 'FeatureOneButtonText', |
|
| 120 | + _t(__CLASS__ . '.FeatureButtonText', 'Button text') |
|
| 121 | + ), |
|
| 122 | + TreeDropdownField::create( |
|
| 123 | + 'FeatureOneLinkID', |
|
| 124 | + _t(__CLASS__ . '.FeatureLink', 'Page to link to'), |
|
| 125 | + SiteTree::class |
|
| 126 | + )->setDescription(_t(__CLASS__ . '.ButtonTextRequired', 'Button text must be filled in')) |
|
| 127 | + ) |
|
| 128 | + )->setHeadingLevel(3) |
|
| 129 | + ); |
|
| 130 | + $dropdownField->setEmptyString('none'); |
|
| 131 | + |
|
| 132 | + $fields->addFieldToTab('Root.Features', ToggleCompositeField::create( |
|
| 133 | + 'FeatureTwo', |
|
| 134 | + _t(__CLASS__ . '.FeatureTwo', 'Feature Two'), |
|
| 135 | + array( |
|
| 136 | + TextField::create('FeatureTwoTitle', _t(__CLASS__ . '.Title', 'Title')), |
|
| 137 | + $dropdownField = DropdownField::create( |
|
| 138 | + 'FeatureTwoCategory', |
|
| 139 | + _t(__CLASS__ . '.FeatureCategoryDropdown', 'Category icon'), |
|
| 140 | + singleton(BaseHomePage::class)->dbObject('FeatureTwoCategory')->enumValues() |
|
| 141 | + ), |
|
| 142 | + HTMLEditorField::create( |
|
| 143 | + 'FeatureTwoContent', |
|
| 144 | + _t(__CLASS__ . '.FeatureContentFieldLabel', 'Content') |
|
| 145 | + ), |
|
| 146 | + TextField::create( |
|
| 147 | + 'FeatureTwoButtonText', |
|
| 148 | + _t(__CLASS__ . '.FeatureButtonText', 'Button text') |
|
| 149 | + ), |
|
| 150 | + TreeDropdownField::create( |
|
| 151 | + 'FeatureTwoLinkID', |
|
| 152 | + _t(__CLASS__ . '.FeatureLink', 'Page to link to'), |
|
| 153 | + SiteTree::class |
|
| 154 | + )->setDescription(_t(__CLASS__ . '.ButtonTextRequired', 'Button text must be filled in')) |
|
| 155 | + ) |
|
| 156 | + )->setHeadingLevel(3)); |
|
| 157 | + $dropdownField->setEmptyString('none'); |
|
| 158 | + }); |
|
| 159 | + |
|
| 160 | + return parent::getCMSFields(); |
|
| 161 | + } |
|
| 162 | 162 | } |
@@ -7,50 +7,50 @@ |
||
| 7 | 7 | |
| 8 | 8 | class NewsHolder extends DatedUpdateHolder |
| 9 | 9 | { |
| 10 | - private static $description = 'Container page for News Pages, provides news filtering and pagination'; |
|
| 11 | - |
|
| 12 | - private static $allowed_children = [ |
|
| 13 | - NewsPage::class, |
|
| 14 | - ]; |
|
| 15 | - |
|
| 16 | - private static $default_child = NewsPage::class; |
|
| 17 | - |
|
| 18 | - private static $update_name = 'News'; |
|
| 19 | - |
|
| 20 | - private static $update_class = NewsPage::class; |
|
| 21 | - |
|
| 22 | - private static $icon_class = 'font-icon-news'; |
|
| 23 | - |
|
| 24 | - private static $singular_name = 'News Holder'; |
|
| 25 | - |
|
| 26 | - private static $plural_name = 'News Holders'; |
|
| 27 | - |
|
| 28 | - private static $table_name = 'NewsHolder'; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * Find all site's news items, based on some filters. |
|
| 32 | - * Omitting parameters will prevent relevant filters from being applied. The filters are ANDed together. |
|
| 33 | - * |
|
| 34 | - * @param string $className The name of the class to fetch. |
|
| 35 | - * @param int $parentID The ID of the holder to extract the news items from. |
|
| 36 | - * @param int $tagID The ID of the tag to filter the news items by. |
|
| 37 | - * @param string $dateFrom The beginning of a date filter range. |
|
| 38 | - * @param string $dateTo The end of the date filter range. If empty, only one day will be searched for. |
|
| 39 | - * @param int $year Numeric value of the year to show. |
|
| 40 | - * @param int $monthNumber Numeric value of the month to show. |
|
| 41 | - * |
|
| 42 | - * @returns DataList|PaginatedList |
|
| 43 | - */ |
|
| 44 | - public static function AllUpdates( |
|
| 45 | - $className = NewsPage::class, |
|
| 46 | - $parentID = null, |
|
| 47 | - $tagID = null, |
|
| 48 | - $dateFrom = null, |
|
| 49 | - $dateTo = null, |
|
| 50 | - $year = null, |
|
| 51 | - $monthNumber = null |
|
| 52 | - ) { |
|
| 53 | - return parent::AllUpdates($className, $parentID, $tagID, $dateFrom, $dateTo, $year, $monthNumber) |
|
| 54 | - ->Sort('Date', 'DESC'); |
|
| 55 | - } |
|
| 10 | + private static $description = 'Container page for News Pages, provides news filtering and pagination'; |
|
| 11 | + |
|
| 12 | + private static $allowed_children = [ |
|
| 13 | + NewsPage::class, |
|
| 14 | + ]; |
|
| 15 | + |
|
| 16 | + private static $default_child = NewsPage::class; |
|
| 17 | + |
|
| 18 | + private static $update_name = 'News'; |
|
| 19 | + |
|
| 20 | + private static $update_class = NewsPage::class; |
|
| 21 | + |
|
| 22 | + private static $icon_class = 'font-icon-news'; |
|
| 23 | + |
|
| 24 | + private static $singular_name = 'News Holder'; |
|
| 25 | + |
|
| 26 | + private static $plural_name = 'News Holders'; |
|
| 27 | + |
|
| 28 | + private static $table_name = 'NewsHolder'; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * Find all site's news items, based on some filters. |
|
| 32 | + * Omitting parameters will prevent relevant filters from being applied. The filters are ANDed together. |
|
| 33 | + * |
|
| 34 | + * @param string $className The name of the class to fetch. |
|
| 35 | + * @param int $parentID The ID of the holder to extract the news items from. |
|
| 36 | + * @param int $tagID The ID of the tag to filter the news items by. |
|
| 37 | + * @param string $dateFrom The beginning of a date filter range. |
|
| 38 | + * @param string $dateTo The end of the date filter range. If empty, only one day will be searched for. |
|
| 39 | + * @param int $year Numeric value of the year to show. |
|
| 40 | + * @param int $monthNumber Numeric value of the month to show. |
|
| 41 | + * |
|
| 42 | + * @returns DataList|PaginatedList |
|
| 43 | + */ |
|
| 44 | + public static function AllUpdates( |
|
| 45 | + $className = NewsPage::class, |
|
| 46 | + $parentID = null, |
|
| 47 | + $tagID = null, |
|
| 48 | + $dateFrom = null, |
|
| 49 | + $dateTo = null, |
|
| 50 | + $year = null, |
|
| 51 | + $monthNumber = null |
|
| 52 | + ) { |
|
| 53 | + return parent::AllUpdates($className, $parentID, $tagID, $dateFrom, $dateTo, $year, $monthNumber) |
|
| 54 | + ->Sort('Date', 'DESC'); |
|
| 55 | + } |
|
| 56 | 56 | } |
@@ -6,13 +6,13 @@ |
||
| 6 | 6 | |
| 7 | 7 | class SitemapPage extends Page |
| 8 | 8 | { |
| 9 | - private static $description = 'Lists all pages on the site'; |
|
| 9 | + private static $description = 'Lists all pages on the site'; |
|
| 10 | 10 | |
| 11 | - private static $singular_name = 'Sitemap Page'; |
|
| 11 | + private static $singular_name = 'Sitemap Page'; |
|
| 12 | 12 | |
| 13 | - private static $plural_name = 'Sitemap Pages'; |
|
| 13 | + private static $plural_name = 'Sitemap Pages'; |
|
| 14 | 14 | |
| 15 | - private static $table_name = 'SitemapPage'; |
|
| 15 | + private static $table_name = 'SitemapPage'; |
|
| 16 | 16 | |
| 17 | - private static $icon_class = 'font-icon-sitemap'; |
|
| 17 | + private static $icon_class = 'font-icon-sitemap'; |
|
| 18 | 18 | } |
@@ -7,57 +7,57 @@ |
||
| 7 | 7 | |
| 8 | 8 | class EventHolder extends DatedUpdateHolder |
| 9 | 9 | { |
| 10 | - private static $description = 'Container page for Event Pages, provides event filtering and pagination'; |
|
| 11 | - |
|
| 12 | - private static $allowed_children = [ |
|
| 13 | - EventPage::class, |
|
| 14 | - ]; |
|
| 15 | - |
|
| 16 | - private static $default_child = EventPage::class; |
|
| 17 | - |
|
| 18 | - private static $update_name = 'Events'; |
|
| 19 | - |
|
| 20 | - private static $update_class = EventPage::class; |
|
| 21 | - |
|
| 22 | - private static $icon_class = 'font-icon-p-event-alt'; |
|
| 23 | - |
|
| 24 | - private static $singular_name = 'Event Holder'; |
|
| 25 | - |
|
| 26 | - private static $plural_name = 'Event Holders'; |
|
| 27 | - |
|
| 28 | - private static $table_name = 'EventHolder'; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * Find all site's news items, based on some filters. |
|
| 32 | - * Omitting parameters will prevent relevant filters from being applied. The filters are ANDed together. |
|
| 33 | - * |
|
| 34 | - * @param string $className The name of the class to fetch. |
|
| 35 | - * @param int $parentID The ID of the holder to extract the news items from. |
|
| 36 | - * @param int $tagID The ID of the tag to filter the news items by. |
|
| 37 | - * @param string $dateFrom The beginning of a date filter range. |
|
| 38 | - * @param string $dateTo The end of the date filter range. If empty, only one day will be searched for. |
|
| 39 | - * @param int $year Numeric value of the year to show. |
|
| 40 | - * @param int $monthNumber Numeric value of the month to show. |
|
| 41 | - * |
|
| 42 | - * @returns DataList|PaginatedList |
|
| 43 | - */ |
|
| 44 | - public static function AllUpdates( |
|
| 45 | - $className = 'Events', |
|
| 46 | - $parentID = null, |
|
| 47 | - $tagID = null, |
|
| 48 | - $dateFrom = null, |
|
| 49 | - $dateTo = null, |
|
| 50 | - $year = null, |
|
| 51 | - $monthNumber = null |
|
| 52 | - ) { |
|
| 53 | - return parent::AllUpdates( |
|
| 54 | - $className, |
|
| 55 | - $parentID, |
|
| 56 | - $tagID, |
|
| 57 | - $dateFrom, |
|
| 58 | - $dateTo, |
|
| 59 | - $year, |
|
| 60 | - $monthNumber |
|
| 61 | - )->Sort('Date', 'ASC'); |
|
| 62 | - } |
|
| 10 | + private static $description = 'Container page for Event Pages, provides event filtering and pagination'; |
|
| 11 | + |
|
| 12 | + private static $allowed_children = [ |
|
| 13 | + EventPage::class, |
|
| 14 | + ]; |
|
| 15 | + |
|
| 16 | + private static $default_child = EventPage::class; |
|
| 17 | + |
|
| 18 | + private static $update_name = 'Events'; |
|
| 19 | + |
|
| 20 | + private static $update_class = EventPage::class; |
|
| 21 | + |
|
| 22 | + private static $icon_class = 'font-icon-p-event-alt'; |
|
| 23 | + |
|
| 24 | + private static $singular_name = 'Event Holder'; |
|
| 25 | + |
|
| 26 | + private static $plural_name = 'Event Holders'; |
|
| 27 | + |
|
| 28 | + private static $table_name = 'EventHolder'; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * Find all site's news items, based on some filters. |
|
| 32 | + * Omitting parameters will prevent relevant filters from being applied. The filters are ANDed together. |
|
| 33 | + * |
|
| 34 | + * @param string $className The name of the class to fetch. |
|
| 35 | + * @param int $parentID The ID of the holder to extract the news items from. |
|
| 36 | + * @param int $tagID The ID of the tag to filter the news items by. |
|
| 37 | + * @param string $dateFrom The beginning of a date filter range. |
|
| 38 | + * @param string $dateTo The end of the date filter range. If empty, only one day will be searched for. |
|
| 39 | + * @param int $year Numeric value of the year to show. |
|
| 40 | + * @param int $monthNumber Numeric value of the month to show. |
|
| 41 | + * |
|
| 42 | + * @returns DataList|PaginatedList |
|
| 43 | + */ |
|
| 44 | + public static function AllUpdates( |
|
| 45 | + $className = 'Events', |
|
| 46 | + $parentID = null, |
|
| 47 | + $tagID = null, |
|
| 48 | + $dateFrom = null, |
|
| 49 | + $dateTo = null, |
|
| 50 | + $year = null, |
|
| 51 | + $monthNumber = null |
|
| 52 | + ) { |
|
| 53 | + return parent::AllUpdates( |
|
| 54 | + $className, |
|
| 55 | + $parentID, |
|
| 56 | + $tagID, |
|
| 57 | + $dateFrom, |
|
| 58 | + $dateTo, |
|
| 59 | + $year, |
|
| 60 | + $monthNumber |
|
| 61 | + )->Sort('Date', 'ASC'); |
|
| 62 | + } |
|
| 63 | 63 | } |
@@ -9,59 +9,59 @@ |
||
| 9 | 9 | |
| 10 | 10 | class NewsPage extends DatedUpdatePage |
| 11 | 11 | { |
| 12 | - private static $description = 'Describes an item of news'; |
|
| 12 | + private static $description = 'Describes an item of news'; |
|
| 13 | 13 | |
| 14 | - private static $default_parent = 'NewsHolderPage'; |
|
| 14 | + private static $default_parent = 'NewsHolderPage'; |
|
| 15 | 15 | |
| 16 | - private static $can_be_root = false; |
|
| 16 | + private static $can_be_root = false; |
|
| 17 | 17 | |
| 18 | - private static $icon_class = 'font-icon-p-news-item'; |
|
| 18 | + private static $icon_class = 'font-icon-p-news-item'; |
|
| 19 | 19 | |
| 20 | - private static $singular_name = 'News Page'; |
|
| 20 | + private static $singular_name = 'News Page'; |
|
| 21 | 21 | |
| 22 | - private static $plural_name = 'News Pages'; |
|
| 22 | + private static $plural_name = 'News Pages'; |
|
| 23 | 23 | |
| 24 | - private static $db = [ |
|
| 25 | - 'Author' => 'Varchar(255)', |
|
| 26 | - ]; |
|
| 24 | + private static $db = [ |
|
| 25 | + 'Author' => 'Varchar(255)', |
|
| 26 | + ]; |
|
| 27 | 27 | |
| 28 | - private static $has_one = [ |
|
| 29 | - 'FeaturedImage' => Image::class, |
|
| 30 | - ]; |
|
| 28 | + private static $has_one = [ |
|
| 29 | + 'FeaturedImage' => Image::class, |
|
| 30 | + ]; |
|
| 31 | 31 | |
| 32 | - private static $owns = [ |
|
| 33 | - 'FeaturedImage', |
|
| 34 | - ]; |
|
| 32 | + private static $owns = [ |
|
| 33 | + 'FeaturedImage', |
|
| 34 | + ]; |
|
| 35 | 35 | |
| 36 | - private static $table_name = 'NewsPage'; |
|
| 36 | + private static $table_name = 'NewsPage'; |
|
| 37 | 37 | |
| 38 | - public function fieldLabels($includerelations = true) |
|
| 39 | - { |
|
| 40 | - $labels = parent::fieldLabels($includerelations); |
|
| 41 | - $labels['Author'] = _t('CWP\\CWP\\PageTypes\\DateUpdatePage.AuthorFieldLabel', 'Author'); |
|
| 42 | - $labels['FeaturedImageID'] = _t( |
|
| 43 | - 'CWP\\CWP\\PageTypes\\DateUpdatePage.FeaturedImageFieldLabel', |
|
| 44 | - 'Featured Image' |
|
| 45 | - ); |
|
| 38 | + public function fieldLabels($includerelations = true) |
|
| 39 | + { |
|
| 40 | + $labels = parent::fieldLabels($includerelations); |
|
| 41 | + $labels['Author'] = _t('CWP\\CWP\\PageTypes\\DateUpdatePage.AuthorFieldLabel', 'Author'); |
|
| 42 | + $labels['FeaturedImageID'] = _t( |
|
| 43 | + 'CWP\\CWP\\PageTypes\\DateUpdatePage.FeaturedImageFieldLabel', |
|
| 44 | + 'Featured Image' |
|
| 45 | + ); |
|
| 46 | 46 | |
| 47 | - return $labels; |
|
| 48 | - } |
|
| 47 | + return $labels; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - public function getCMSFields() |
|
| 51 | - { |
|
| 52 | - $this->beforeUpdateCMSFields(function (FieldList $fields) { |
|
| 53 | - $fields->addFieldToTab( |
|
| 54 | - 'Root.Main', |
|
| 55 | - TextField::create('Author', $this->fieldLabel('Author')), |
|
| 56 | - 'Abstract' |
|
| 57 | - ); |
|
| 50 | + public function getCMSFields() |
|
| 51 | + { |
|
| 52 | + $this->beforeUpdateCMSFields(function (FieldList $fields) { |
|
| 53 | + $fields->addFieldToTab( |
|
| 54 | + 'Root.Main', |
|
| 55 | + TextField::create('Author', $this->fieldLabel('Author')), |
|
| 56 | + 'Abstract' |
|
| 57 | + ); |
|
| 58 | 58 | |
| 59 | - $fields->addFieldToTab( |
|
| 60 | - 'Root.Main', |
|
| 61 | - UploadField::create('FeaturedImage', $this->fieldLabel('FeaturedImageID')), |
|
| 62 | - 'Abstract' |
|
| 63 | - ); |
|
| 64 | - }); |
|
| 65 | - return parent::getCMSFields(); |
|
| 66 | - } |
|
| 59 | + $fields->addFieldToTab( |
|
| 60 | + 'Root.Main', |
|
| 61 | + UploadField::create('FeaturedImage', $this->fieldLabel('FeaturedImageID')), |
|
| 62 | + 'Abstract' |
|
| 63 | + ); |
|
| 64 | + }); |
|
| 65 | + return parent::getCMSFields(); |
|
| 66 | + } |
|
| 67 | 67 | } |