Source of file AdvertCategory.php
Size: 1,151 Bytes - Last Modified: 2021-12-23T10:58:29+00:00
/var/www/docs.ssmods.com/process/src/code/AdvertCategory.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445 | <?php /** * Each advert belongs to a category. The category of a page, or one an ancestor page (e.g. parent, grandparent etc) * determines the advert category selected for rendering. */ class AdvertCategory extends DataObject { public static $searchable_fields = array( 'Title', ); public static $has_many = array( 'Adverts' => 'Advert', ); public static $db = array( // name of the category 'Title' => 'Varchar(255)', // whether or not ads are enabled 'Enabled' => 'Boolean', ); public static $summary_fields = array( 'Title' => 'Title', 'Enabled' => 'Enabled', ); public function getCMSFields() { $fields = new FieldList(); // add a tab $fields->push(new TabSet('Root', $mainTab = new Tab('Main'))); $mainTab->setTitle(_t('SiteTree.TABMAIN', 'Main')); $fields->addFieldToTab('Root.Main', new TextField('Title', 'The name of the category')); $fields->addFieldToTab('Root.Main', new CheckboxField('Enabled', 'Are adverts for this category enabled?')); return $fields; } } |