Hi guys. I have a "holder" page that is holding subpages, one of which is a simple one album gallery. I have an AssetFolder field in the $db of the holder page to name the subfolder in /assets that all the files from any subpage upload will be stored in. I am trying to setup an AlbumImage class, that would save in the /assets/AssetFolder/images class, for example.
Firstly, I would like to know how to access the AssetFolder from my class if the tree is like this:
Holder > OneAlbumGallery Page > Dataobject (AlbumImage)
class AlbumImage extends DataObject {
static $db = array(
'Name' => 'Text',
'Description' => 'Text',
);
static $has_one = array (
'File' => 'Image',
'Page' => 'OneAlbumGallery'
);
function getCMSFields_forPopup() {
//$assetFolder = $this->Page->Parent->AssetFolder();
return new FieldSet(
new TextField('Name'),
new TextareaField('Description'),
new SimpleImageField('File','Select image',null,null,null,$assetFolder.'/images')
);
}
}
Secondly, it seems that even if I enter the correct AssetFolder by hand in the code above, the images are still saved in the Uploads. I thought this had been resolved in 2.4? Maybe I'm using the wrong syntax?