how to Install Page Type
Permalink
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
Please help and tell alternative way with example
$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
Please help and tell alternative way with example
Notice the private function for creating the page type, and it's checking to see if it already exists and if not, create it.