How can I set the default page type of children pages to inherit the page type of the parent.
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.
Not sure if I follow what you are asking entirely, but it sounds like $default_parent and $default_child are what you are after.
http://doc.silverstripe.org/doku.php?id=recipes:customising-the-hierarchy
Cheers
Aaron
What I want is if I have a Products page with sub pages i.e.
Products
> Product 1
> Product 2
I want "Product 1" and "Product 2" to inherit the page type of "Products" so that whenever I add in a new product it defaults to the correct page type rather than the "Page" type.
You can include this in any page class and it will restrict the children allowed to whatever is in the array:
static $allowed_children = array('ProductPage');
BBC, did you check the link I gave? The very first example shows how to do exactly what you want, using both mine and howard's suggestions in tandem.
Aaron
Thanks, I did look at the link but I was confused at first glance. Looking back I now have what I want, it was as you said.. the first part i.e.
static $allowed_children = array("BlogEntry");
static $default_child = "BlogEntry";