public function __construct($name, $title = null, \SS_List $items = null) { parent::__construct($name, $title, $items); // Update templates to avoid cms styles $this->setTemplate('forms/FrontendUploadField'); $this->setTemplateFileEdit('forms/FrontendUploadField_FileEdit'); $this->setTemplateFileButtons('forms/FrontendUploadField_FileButtons'); $this->setDownloadTemplateName('ss-frontenduploadfield-downloadtemplate'); $this->setUploadTemplateName('ss-frontenduploadfield-uploadtemplate'); // Configure to something more bullet proof $this->setCanAttachExisting(false); // Block access to Silverstripe assets library $this->setCanPreviewFolder(false); // Don't show target filesystem folder on upload field $this->relationAutoSetting = false; // Prevents the form thinking the GalleryPage is the underlying object $this->setConfig('overwriteWarning', false); $this->getUpload()->setReplaceFile(false); //the page crash if we click edit before the page is loaded Requirements::customCSS('.ss-uploadfield-item-edit.disabled { background:#eee; color:#666}'); Requirements::customScript("jQuery('.ss-uploadfield-item-edit').attr('disabled','disabled').addClass('disabled');\njQuery(window).load(function() {\n\tjQuery('.ss-uploadfield-item-editform').removeClass('loading'); //fix edit form in frontend\n\tjQuery('.ss-uploadfield-item-edit').removeAttr('disabled').removeClass('disabled');\n});\n", "FrontendUploadFieldFix"); }
public function __construct($name, $title = null, \SS_List $items = null) { parent::__construct($name, $title, $items); $this->setImageOptions(); }