Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Can't add VirtualPage as allowed children


Go to End


997 Views

Avatar
thomas.paulson

Community Member, 107 Posts

17 February 2015 at 7:29pm

Edited: 17/02/2015 7:33pm

I created Holder Page as below, done database rebuild successfully. But in cms can't add 'virtual page' under KochiHolder page.
class KochiHolder extends Page{
private static $db = array(
);
private static $has_one = array(
'Photo' => 'Image'
);
private static $can_be_root = false;
private static $allowed_children = array('KochiPage','VirtualPage');

public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Images", new UploadField('Photo'));
return $fields;
}

}// class KochiTree extends Page{