/**
  * Get list of fields for previewing this records details
  *
  * @return FieldList
  */
 protected function getDetailFields()
 {
     $fields = new FieldList(ReadonlyField::create("FileType", _t('AssetTableField.TYPE', 'File type'), $this->getFileType()), HTMLReadonlyField::create('ClickableURL', _t('AssetTableField.URL', 'URL'), $this->getExternalLink()));
     // Get file size
     if ($this->getSize()) {
         $fields->insertAfter('FileType', ReadonlyField::create("Size", _t('AssetTableField.SIZE', 'File size'), $this->getSize()));
     }
     // Get modified details of local record
     if ($this->getFile()) {
         $fields->push(new DateField_Disabled("Created", _t('AssetTableField.CREATED', 'First uploaded'), $this->getFile()->Created));
         $fields->push(new DateField_Disabled("LastEdited", _t('AssetTableField.LASTEDIT', 'Last changed'), $this->getFile()->LastEdited));
     }
     return $fields;
 }
Пример #2
0
 /**
  * Returns the fields to power the edit screen of files in the CMS.
  * You can modify this FieldList by subclassing folder, or by creating a {@link DataExtension}
  * and implemeting updateCMSFields(FieldList $fields) on that extension.
  *
  * @return FieldList
  */
 public function getCMSFields()
 {
     // Preview
     $filePreview = CompositeField::create(CompositeField::create(new LiteralField("ImageFull", $this->PreviewThumbnail()))->setName("FilePreviewImage")->addExtraClass('cms-file-info-preview'), CompositeField::create(CompositeField::create(new ReadonlyField("FileType", _t('AssetTableField.TYPE', 'File type') . ':'), new ReadonlyField("Size", _t('AssetTableField.SIZE', 'File size') . ':', $this->getSize()), HTMLReadonlyField::create('ClickableURL', _t('AssetTableField.URL', 'URL'), sprintf('<a href="%s" target="_blank">%s</a>', $this->Link(), $this->Link())), new DateField_Disabled("Created", _t('AssetTableField.CREATED', 'First uploaded') . ':'), new DateField_Disabled("LastEdited", _t('AssetTableField.LASTEDIT', 'Last changed') . ':')))->setName("FilePreviewData")->addExtraClass('cms-file-info-data'))->setName("FilePreview")->addExtraClass('cms-file-info');
     //get a tree listing with only folder, no files
     $fields = new FieldList(new TabSet('Root', new Tab('Main', $filePreview, new TextField("Title", _t('AssetTableField.TITLE', 'Title')), new TextField("Name", _t('AssetTableField.FILENAME', 'Filename')), DropdownField::create("OwnerID", _t('AssetTableField.OWNER', 'Owner'), Member::mapInCMSGroups())->setHasEmptyDefault(true), new TreeDropdownField("ParentID", _t('AssetTableField.FOLDER', 'Folder'), 'Folder'))));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }