Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.

Commit 268f30c

Browse files
author
Otis Wright
committed
Default site config setting
1 parent 6bf96e7 commit 268f30c

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

_config/config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ SiteTree:
99
extensions:
1010
- ExtraPageFieldsExtension
1111

12+
SiteConfig:
13+
extensions:
14+
- WebFoxSiteConfig
15+
1216
Image:
1317
extensions:
1418
- ImageExtension

code/WebFoxSiteConfigExtension.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
/**
4+
* Class CustomSiteConfig
5+
*
6+
* @property SiteConfig $owner
7+
*/
8+
class WebFoxSiteConfig extends DataExtension {
9+
10+
static $db = [
11+
'CustomHeaderOutput' => 'Text',
12+
'CustomFooterOutput' => 'Text'
13+
];
14+
15+
static $has_one = [
16+
'PrivacyPolicyPage' => 'SiteTree',
17+
'TermsAndConditionsPage' => 'SiteTree'
18+
];
19+
20+
public function updateCMSFields(FieldList $fields) {
21+
22+
$fields->addFieldsToTab('Root.Main', [
23+
TreeDropdownField::create('PrivacyPolicyPageID', 'Privacy Policy', 'SiteTree'),
24+
TreeDropdownField::create('TermsAndConditionsPageID', 'Terms & Conditions', 'SiteTree')
25+
]);
26+
27+
$fields->addFieldsToTab('Root.Advanced', [
28+
TextareaField::create('CustomHeaderOutput', 'Custom Header Tags'),
29+
TextareaField::create('CustomFooterOutput', 'Custom Footer Tags')
30+
]);
31+
}
32+
}

0 commit comments

Comments
 (0)