Source of file LivetickerMessage.php
Size: 1,249 Bytes - Last Modified: 2021-12-23T10:51:27+00:00
/var/www/docs.ssmods.com/process/src/src/Models/LivetickerMessage.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 | <?php namespace TheWebmen\Liveticker\Models; use SilverStripe\Forms\DropdownField; use SilverStripe\ORM\DataObject; use TheWebmen\Liveticker\Pages\LivetickerPage; class LivetickerMessage extends DataObject { private static $singular_name = 'Message'; private static $plural_name = 'Messages'; private static $table_name = 'LivetickerMessage'; private static $db = [ 'Title' => 'Varchar(255)', 'Message' => 'HTMLText', 'ExtraClasses' => 'Varchar(255)' ]; private static $has_one = [ 'Page' => LivetickerPage::class, 'Category' => LivetickerCategory::class ]; private static $summary_fields = [ 'Title', 'Category.Title' => 'Category' ]; private static $default_sort = 'Created DESC'; public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('PageID'); $categories = LivetickerCategory::get()->filter('PageID', $this->PageID)->map(); $fields->addFieldToTab('Root.Main', DropdownField::create('CategoryID', 'Category', $categories)->setHasEmptyDefault(true)); return $fields; } public function canView($member = null) { return true; } } |