Source of file ImageResource.php
Size: 0,917 Bytes - Last Modified: 2021-12-23T10:11:59+00:00
/var/www/docs.ssmods.com/process/src/code/DataObject/ImageResource.php
12345678910111213141516171819202122232425262728293031323334353637383940 | <?php class ImageResource extends DataObject { static $db = array( 'Title' => 'Varchar(100)', 'Caption' => 'HTMLText', ); static $has_one = array( 'Image' => 'Image', 'SectionGalleryBlock' => 'SectionGalleryBlock', 'SectionLogoBlock' => 'SectionLogoBlock', ); public function getCMSFields() { $fields = parent::getCMSFields(); $fieldList = FieldList::create( TextField::create('Title', 'Title'), HtmlEditorField::create('Caption', 'Caption')->setRows(4) ); $uploadField = UploadField::create('Image'); $uploadField->setFolderName('SectionGalleryImages'); $uploadField->getValidator()->setAllowedExtensions(array( 'png', 'gif', 'jpeg', 'jpg' )); $fields->addFieldsToTab("Root.Main", $fieldList); $fields->addFieldToTab("Root.Main", $uploadField); $fields->removeByName('SectionLogoBlockID'); $fields->removeByName('SectionGalleryBlockID'); return $fields; } } |