Source of file SitePhoto.php
Size: 0,807 Bytes - Last Modified: 2021-12-24T06:34:20+00:00
/var/www/docs.ssmods.com/process/src/code/types/SitePhoto.php
123456789101112131415161718192021222324252627282930313233343536373839 | <?php class SitePhoto extends DataExtension implements SiteMediaType_Interface { public static $plural_name = 'Photos'; public static $media_upload_folder = 'Photos'; public static $allowed_file_types = array('jpg','jpeg','gif','png'); private static $has_one = array( 'Photo' => 'Image' ); private static $db = array( 'Caption' => 'Varchar(255)' ); public function updateCMSFields(FieldList $fields) { if($this->owner->MediaType != __CLASS__) return; $fileField = $this->owner->getUploadField('Photo'); $fields->addFieldsToTab('Root.Main', array( new TextField('Caption'), $fileField )); } public function File(){ return $this->owner->Photo(); } public function Thumbnail(){ return $this->owner->Photo(); } } |