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.

Customising the CMS /

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

Possible to determine allowed_children on the fly?


Go to End


1017 Views

Avatar
pingu

Community Member, 75 Posts

29 November 2010 at 5:48pm

I was just wondering if it's possible to determine the allowed_children of a page type on the fly?

I have a Holder type which I'm using in multiple instances. The only difference between each instance is the children that's allowed per holder, and if its possible I'd like to not have to extend the holder class just to encapsulate this information.

I'm wondering if it's possible to do something like this:

if($this->Title == "Activities"){
$allowed_children = "Activity"
}

if($this->Title == "Events"){
$allowed_children = "Event"
}