So if you're reading this article you're either curious or you've been blindly deleting Page Types from your database.
Now you try to add a Stack from Dashboard > Stacks & Blocks > Stacks and get an error:
Fatal error: Call to a member function getPackageID() on a non-object in your_site/concrete/models/page.php on line 2303
Looking at line 2303 in the core page model, we see that concrete5 is checking for a package ID set on a CollectionType-- better known as a Page Type.
When we add a Stack, concrete5 expects a Page Type to exist in the database with the handle core_stack. This is an internal concrete5 component that you'll never see in the Dashboard's "Page Types" page-- it exists behind-the-scenes. concrete5 uses it to create Stacks, as you might imagine. Ever turn on "Show System Pages" in the Sitemap and see this?
That's why this page type is important-- Stacks are actually collections of Blocks, similar to how Pages work in concrete5, and each gets this special Page Type applied upon creation.
Our PageTypes table is missing something crucial:
So to put that core_stack page type back in your database, we'll need to run a query:
INSERT INTO PageTypes (ctID, ctHandle, ctIcon, ctName, ctIsInternal, pkgID) VALUES (1, 'core_stack', 'main.png', 'Stack', 1, 0);
Check out our PageTypes table now:
The core_stack Page Type has been restored, and you can once again add Stacks.
If you're missing one of the other internal Page Types, you're likely having trouble with our community "News" page, aka Newsflow. Use the screenshot above to figure out what values you'll need to re-insert. Of course, you might also find this info by setting up a fresh copy of concrete5 in a different location and checking out how the PageTypes table usually gets set up.