how to Install Page Type

Permalink 1 user found helpful
I want to create page type via controller.php and below code is working in 5.6...

$ct = CollectionType::getByHandle('home');
if((!is_object($ct)) || ($ct->getCollectionTypeID() < 1)) {
$data['ctHandle'] = 'home';
$data['ctName'] = t('Home');
$hpt = CollectionType::add($data, $pkg);
}

What do i do for 5.7

 
focus43 replied on at Permalink Reply
focus43
+1 - was about to ask this same question actually. Additionally, is there any further documentation on how to setup controllers for theme pages types, and what the relationship is with Templates in 5.7?
core77 replied on at Permalink Reply
focus43 replied on at Permalink Reply
focus43
@core77,
You're the man - thanks for linking to your package. Looks well written, and helpful for navigating some of the new 5.7 changes.
planetweb replied on at Permalink Reply
Sorry for late reply but it works for me.

Thanks a lot
core77 replied on at Permalink Reply
Hey guys. I figured out that page types, which are installed from my foundation_sites package, can't be used until you go to the dashboard and set the publish method.

How can we set the publish method for the page types in the package controller?
focus43 replied on at Permalink Best Answer Reply
focus43
Created a GIST with the code to so in controller.php:

https://gist.github.com/jhartman86/e2a279a5d8a4edca2442...

Line ~105 is where it comes into play. Also, you have to include the proper 'use' statement in the header.

Lmk if that helps.

Next question - anyone figured out how to setup pagetype controllers?
core77 replied on at Permalink Reply
Nice. It helped :-)

Thanks!
C5ThemeTeam replied on at Permalink Reply
C5ThemeTeam
Thanks Focus. That Gist worked a treat.
focus43 replied on at Permalink Reply
focus43
For others that might check this post in the future, here's a more complete package for reference:https://github.com/jhartman86/concrete5-5.7.0/tree/sequence/web/pack...

Deals with custom routes (replacing old Tools files), attributes, file sets, templates, and more robust setup of page types.