Source of file ImageResource.php
Size: 1,018 Bytes - Last Modified: 2021-12-23T10:47:47+00:00
/var/www/docs.ssmods.com/process/src/code/ImageResource.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 | <?php // /mysite/code/ImageResource.php //Commented out due to this already being used in tabpage class ImageResource extends DataObject { public static $db = array ( 'Title' => 'Text', 'Caption' => 'Text', 'SortID'=>'Int' ); public static $default_sort='SortID'; static $has_one = array ( 'Attachment' => 'Image', //Needs to be an image 'SuperSizePage' => 'SuperSizePage', 'HomePage' => 'HomePage' ); public static $summary_fields = array( 'Thumbnail'=>'Thumbnail', 'Title' => 'Title', 'Caption' => 'Caption' ); public function getThumbnail() { if ($Image = $this->Attachment()->ID) { return $this->Attachment()->SetWidth(80); } else { return '(No Image)'; } } public function getCMSFields() { return new Fieldlist( new TextField('Title'), new TextareaField('Caption'), new UploadField('Attachment') ); } } |