Programmatically add a new page type and page type defaults from package2 users found helpful
I'm developing a package for a Concrete5 managed website. Using Google I learned how to install blocks from a package using
but found no similar way to install page types from a package and even set its page type defaults.
Is there a straight forward way to achieve this?
I've taken a look at concrete/single_pages/dashboard/pages/types/view.php to see how a page type will be added using the dashboard, but the code in view.php seems very cumbersome.
Many thanks for your help!
Hope this does it for you.
That's what I was searching for. Nearly :-)
Can you also tell me how to edit the page type's defaults?
Let's say I want to add a default Block at two Areas of the page type called "1st Block Area" and "2nd Block Area" - generated in the page type php file with
[...] $a1 = new Area('1st Block Area'); $a1->display($c); $a2 = new Area('2nd Block Area'); $a2->display($c); [...]
What would I do next to your example code?
Many thanks for your support!
Althought I would suggest that if you are building a package to be submited to mp, you dont need to do that.
If your happy with the above answer please consider marking it as Best!:)
My goal is to provide a package for our sekretary to easily install and subsequently add content to the website without configuring anything - such that she hasn't care of anything but the content.
Concrete5 is basically the best choice since it provides an in-context-editing.
I think it would be ok to configure the defaults after installing the package - but my nerd-spirit wants me to automate this step...
I'll have a look at the installation file - so hopefully I'll get an answer.
after instalation edit the defaults in each page type and after that fro each new page created the blocks will be on the page as default.