1 <?php
2 3 4 5 6
7 class NewsSiteConfig extends SiteConfigDecorator {
8
9 static $hidden_fields = array();
10
11 function () {
12 return array(
13 'db' => array(
14 'NewsPerPage' => 'Int',
15 'NewsInRSS' => 'Int',
16 'NewsOnHomePage' => 'Int',
17 'NewsCustomTemplates' => 'Boolean'
18 ),
19 'defaults' => array(
20 'NewsPerPage' => 10,
21 'NewsInRSS' => 20,
22 'NewsOnHomePage' => 5,
23 'NewsCustomTemplates' => false
24 )
25 );
26 }
27
28 public function updateCMSFields(FieldSet &$fields) {
29 $tab = SiteConfigDecorator::get_config_tab($fields, 'News');
30
31 $tab->push(new NumericField('NewsPerPage', _t('SiteConfig.NewsPerPage', 'News Per Page')));
32 $tab->push(new NumericField('NewsInRSS', _t('SiteConfig.NewsInRSS', 'News In RSS')));
33 $tab->push(new NumericField('NewsOnHomePage', _t('SiteConfig.NewsOnHomePage', 'News On Home Page')));
34 if (Director::isDev()) {
35 $tab->push(new CheckboxField('NewsCustomTemplates', _t('SiteConfig.NewsCustomTemplates', 'Custom Templates')));
36 }
37
38 $this->hideUnselectedFields($fields);
39 }
40 }
41
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the
Silverstripe Forums to ask development related questions.
-