Checking for installed page type
Permalink
I'd like to submit a theme to the marketplace and am not sure about this requirement:
If you are adding a new page type, be sure to check that the page type does not exist already before installing:
Loader::model('collection_types');
if(!is_object(CollectionType::getByHandle('home')) {
$data['ctHandle'] = 'home';
$data['ctName'] = t('Home');
$hpt = CollectionType::add($data, $pkg);
}
Where exactly does this code belong?
Thanks!
If you are adding a new page type, be sure to check that the page type does not exist already before installing:
Loader::model('collection_types');
if(!is_object(CollectionType::getByHandle('home')) {
$data['ctHandle'] = 'home';
$data['ctName'] = t('Home');
$hpt = CollectionType::add($data, $pkg);
}
Where exactly does this code belong?
Thanks!
Be sure to mark as an answer if it helps.
Job.