コード例 #1
0
 protected function getFormFields(Controller $controller, $name, $context = [])
 {
     $record = $context['Record'];
     $fields = new FieldList(LiteralField::create('Thumbnail', $this->getIconMarkup($record)), LiteralField::create('FileSpecs', $this->getSpecsMarkup($record)), ReadonlyField::create("Title", File::singleton()->fieldLabel('Title')), ReadonlyField::create('Name', File::singleton()->fieldLabel('Filename')), ReadonlyField::create("Path", _t('AssetTableField.PATH', 'Path'), $this->getPath($record)));
     $this->invokeWithExtensions('updateFormFields', $fields, $controller, $name, $context);
     return $fields;
 }
コード例 #2
0
 protected function getFormFieldDetailsTab($record, $context = [])
 {
     // Update details tab
     $tab = Tab::create('Details', TextField::create("Title", File::singleton()->fieldLabel('Title')), TextField::create('Name', File::singleton()->fieldLabel('Filename')), ReadonlyField::create("Path", _t('AssetTableField.PATH', 'Path'), $this->getPath($record)));
     if ($this->getFormType($context) !== static::TYPE_ADMIN) {
         $tab->push(LiteralField::create('EditLink', sprintf('<a href="%s" class="%s" target="_blank"><i class="%s" />%s</a>', $record->CMSEditLink(), 'btn btn-secondary-outline font-icon-edit editor__edit-link', '', _t('AssetAdmin.EditLink', 'Edit original file'))));
     }
     return $tab;
 }
コード例 #3
0
 protected function getDetailFields()
 {
     $fields = parent::getDetailFields();
     $width = $this->getOriginalWidth();
     $height = $this->getOriginalHeight();
     // Show dimensions of original
     if ($width && $height) {
         $fields->insertAfter('ClickableURL', ReadonlyField::create("OriginalWidth", _t('AssetTableField.WIDTH', 'Width'), $width));
         $fields->insertAfter('OriginalWidth', ReadonlyField::create("OriginalHeight", _t('AssetTableField.HEIGHT', 'Height'), $height));
     }
     return $fields;
 }
コード例 #4
0
 public function getCMSFields()
 {
     $path = '/' . dirname($this->getFilename());
     $previewLink = Convert::raw2att($this->PreviewLink());
     $image = "<img src=\"{$previewLink}\" class=\"editor__thumbnail\" />";
     $link = $this->Link();
     $statusTitle = $this->getStatusTitle();
     $statusFlag = "<span class=\"editor__status-flag\">{$statusTitle}</span>";
     $content = Tab::create('Main', HeaderField::create('TitleHeader', $this->Title, 1)->addExtraClass('editor__heading'), LiteralField::create("ImageFull", $image)->addExtraClass('editor__file-preview'), TabSet::create('Editor', Tab::create('Details', TextField::create("Title", $this->fieldLabel('Title')), TextField::create("Name", $this->fieldLabel('Filename')), ReadonlyField::create("Path", _t('AssetTableField.PATH', 'Path'), ($path !== '/.' ? $path : '') . '/'), HTMLReadonlyField::create('ClickableURL', _t('AssetTableField.URL', 'URL'), sprintf('<i class="%s"></i><a href="%s" target="_blank">%s</a>', 'font-icon-link btn--icon-large form-control-static__icon', $link, $link))), Tab::create('Usage', DatetimeField::create("Created", _t('AssetTableField.CREATED', 'First uploaded'))->setReadonly(true), DatetimeField::create("LastEdited", _t('AssetTableField.LASTEDIT', 'Last changed'))->setReadonly(true))), HiddenField::create('ID', $this->ID));
     if ($dimensions = $this->getDimensions()) {
         $content->insertAfter('TitleHeader', LiteralField::create("DisplaySize", sprintf('<div class="editor__specs">%spx, %s %s</div>', $dimensions, $this->getSize(), $statusFlag)));
     } else {
         $content->insertAfter('TitleHeader', LiteralField::create('StatusFlag', $statusFlag));
     }
     $fields = FieldList::create(TabSet::create('Root', $content));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
コード例 #5
0
 public function getCMSFields()
 {
     $fields = new FieldList(new TabSet('Root'));
     if ($this->IsInferred) {
         $fields->addFieldToTab('Root.Main', ReadonlyField::create('Name', $this->fieldLabel('Name')));
     } else {
         $fields->addFieldToTab('Root.Main', TextField::create('Name', $this->fieldLabel('Name')));
     }
     if ($this->isInDB()) {
         $fields->addFieldToTab('Root.Main', ReadonlyField::create('State', $this->fieldLabel('State')));
     }
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
コード例 #6
0
 /**
  * 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;
 }