I have multiple gallery pages (OurWorkPage) and would like to have a distinct setFolderName for each one. I've successfully added the ID to the folder name, but what I really want is the Title or MenuTitle of OurWorkPage.
class ProjectImage extends DataObject {
public static $has_one = array(
'OurWorkPage' => 'OurWorkPage',
'ProjectImage' => 'Image'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$imageField = new UploadField('ProjectImage','Project Image');
$imageField->setFolderName('Our-Work-Images-'.$this->OurWorkPageID);
…
}
}
Thanks