Open Zauberfisch opened 13 years ago
I changed line 148 of KickAssetField.php to
$folder = $this->defaultFolder ? $this->defaultFolder : singleton('Folder');
this seems to work for me. The reason I think is that setDefaultFolder() already uses Folder::findOrMake() so a folder object was being passed as input here instead of a string.
The problem seems to be caused by the BrowseLink() function.However to make it still work as intended, since $this->defaultFolder is actually a Folder Object and findOrMake needs string, the function needs to be written like this:
public function BrowseLink() {
$folder = $this->defaultFolder
// findOrMake requires a string for a path that is relative to the assets folder
? Folder::findOrMake(str_replace("assets/", "", $this->defaultFolder->Filename))
: singleton('Folder');
return Director::absoluteBaseURL() . "admin/files/select/{$folder->ID}";
}
$file->setDefaultFolder('test');
this will create 'test', and store my files in test, but it also creates a folder named 'folder'.