Since I started developing in EPiServer, I have always found how nicely written their framework is. One thing i have noticed though, is the fact that you really can't hook into their "Create New", "Delete Page" pages. I have also had an issue that there is not a way to group PageTypes in the admin mode or Create new screen.
I have been working on a project at work where there are a boat load of PageTypes and it has become quite tiresome searching for the right PageType. You know the PageType exists, you just can't find it in the list. So I decided to dig into the create new page and find a way to group these PageTypes and allow searching as well in case they do not want to use the tabs. The only issue that i have found so far is there is no admin/edit interface to group PgeTypes but that is okay with me since i am a coder. I have although created the same thing without using PageTypeBuilder but as mentioned earlier, I am a coder so I chose to use this blog and spend more time with this project.
Using PageTypeTabs
In order to use PageTypeTabs, you will need to make sure you hae reference PageTypeBuilder in your project. This code does use PageTypeBuilder to find the proper PageTypes based on the classes we marked with a PageTypeTab Attribute.
Creating a Tab
Adding PageTypeTab Attribute To Our PageType Class
Now that we have our PageTypeTab created, we need to assign it to a PageType by adding an attribute to the PageType class we created using PageTypeBuilder. Below, you will see find the syntax of adding the attribute to the class.
Adding Virtual Path Mapping
Now that wasn't so hard now was it? It is the same process as adding a Tab to a PageTypeProperty in PageTypeBuilder. Is isn't by accident, I used some of Joel's framework to architecture to make it as common as possible so you don't have to do it another way all the time.
There is one last step to do and that is tap into the create new page url and show our page instead of EPiServers page. The following code will need to be added to the episerver.config file in order for us to intercept the createnew page url.
What We've Achieved (Search built in)
Get The Files
Download PageTypeTabs (includes PageTypeBuilder 1.3.1)