Source of file AdvertLayoutType.php
Size: 1,341 Bytes - Last Modified: 2021-12-23T10:58:29+00:00
/var/www/docs.ssmods.com/process/src/code/AdvertLayoutType.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 | <?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 AdvertLayoutType extends DataObject { public static $searchable_fields = array( 'Title', ); public static $db = array( // name of the layout type, e.g. 'main banner' or 'skyscraper' 'Title' => 'Varchar(255)', // whether or not ads are enabled 'Width' => 'Int', 'Height' => 'Int', ); public static $summary_fields = array( 'Title' => 'Title', 'Width' => 'Width', 'Height' => 'Height', ); public static $has_many = array( 'Adverts' => 'Advert', ); 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 NumericField('Width', 'The width of the advert in pixels')); $fields->addFieldToTab('Root.Main', new NumericField('Height', 'The height of the advert in pixels')); return $fields; } } |