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;
 }
 protected function getFormFields(Controller $controller, $name, $context = [])
 {
     $record = $context['Record'];
     // Build standard fields for all folders / files
     /** @var File $record */
     $fields = new FieldList(HeaderField::create('TitleHeader', $record ? $record->Title : null, 1)->addExtraClass('editor__heading'), LiteralField::create("IconFull", $this->getIconMarkup($record))->addExtraClass('editor__file-preview'), $this->getFormFieldTabs($record, $context));
     if ($record) {
         $fields->push(HiddenField::create('ID', $record->ID));
     }
     $this->invokeWithExtensions('updateFormFields', $fields, $controller, $name, $context);
     return $fields;
 }
 /**
  * Return the FieldList used to edit this folder 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()
 {
     // Don't show readonly path until we can implement parent folder selection,
     // it's too confusing when readonly (makes sense for files only).
     $width = (int) Image::config()->get('asset_preview_width');
     $previewLink = Convert::raw2att($this->ScaleMaxWidth($width)->getIcon());
     $image = "<img src=\"{$previewLink}\" class=\"editor__thumbnail\" />";
     $content = Tab::create('Main', HeaderField::create('TitleHeader', $this->Title, 1)->addExtraClass('editor__heading'), LiteralField::create("IconFull", $image)->addExtraClass('editor__file-preview'), TabSet::create('Editor', Tab::create('Details', TextField::create("Name", $this->fieldLabel('Filename')))), HiddenField::create('ID', $this->ID));
     $fields = FieldList::create(TabSet::create('Root', $content));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 /**
  * Get the search context from {@link File}, used to create the search form
  * as well as power the /search API endpoint.
  *
  * @return SearchContext
  */
 public function getSearchContext()
 {
     $context = File::singleton()->getDefaultSearchContext();
     // Customize fields
     $dateHeader = HeaderField::create('Date', _t('CMSSearch.FILTERDATEHEADING', 'Date'), 4);
     $dateFrom = DateField::create('CreatedFrom', _t('CMSSearch.FILTERDATEFROM', 'From'))->setConfig('showcalendar', true);
     $dateTo = DateField::create('CreatedTo', _t('CMSSearch.FILTERDATETO', 'To'))->setConfig('showcalendar', true);
     $dateGroup = FieldGroup::create($dateHeader, $dateFrom, $dateTo);
     $context->addField($dateGroup);
     /** @skipUpgrade */
     $appCategories = array('archive' => _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.AppCategoryArchive', 'Archive'), 'audio' => _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.AppCategoryAudio', 'Audio'), 'document' => _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.AppCategoryDocument', 'Document'), 'flash' => _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.AppCategoryFlash', 'Flash', 'The fileformat'), 'image' => _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.AppCategoryImage', 'Image'), 'video' => _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.AppCategoryVideo', 'Video'));
     $context->addField($typeDropdown = new DropdownField('AppCategory', _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.Filetype', 'File type'), $appCategories));
     $typeDropdown->setEmptyString(' ');
     $currentfolderLabel = _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.CurrentFolderOnly', 'Limit to current folder?');
     $context->addField(new CheckboxField('CurrentFolderOnly', $currentfolderLabel));
     $context->getFields()->removeByName('Title');
     return $context;
 }