Пример #1
0
 /**
  * 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;
 }
 public function setValue($value)
 {
     // Regenerate links prior to preview, so that the editor can see them.
     $value = Image::regenerate_html_links($value);
     return parent::setValue($value);
 }