create page type with kentico API

hadi tag asked on February 18, 2015 17:26

hi

how to i can create new page type with custom field by kentico api in my webpart?

Correct Answer

Brenden Kehren answered on February 18, 2015 20:23

Its a pretty involved task you're looking to do. I'd suggest start by looking at the code that's already there to do this task in this folder: \CMSModules\DocumentTypes\Pages\Development\

There is a DocumentType_New.aspx file that references a user control located in this folder: \CMSModules\AdminControls\Controls\Class\NewClassWizard.ascx. This control should have what you're looking for. If you're looking to customize it, I'd suggest creating a clone of it before modifying the base control.

2 votesVote for this answer Unmark Correct answer

Recent Answers


Jiří Vrabec answered on November 10, 2015 15:48 (last edited on November 11, 2015 09:23)

Hello,

I have some question about to create and delete page types. I tried this scenario:

1.) I created a new page type (with name tmp) with "Allowed parent page types" as "Root (CMS.Root)"
2.) Then I created page in me site inherited from tmp type in root of me site
3.) Then I changed inheritance type for page tmp to none

I looked back to me web and there are no changes or mark, that this page is no more allowed to inherit from root. There are also no message (when I deleted page type) about pages which is currently inherited from. Is it possible to add some extra message (when page type parents is changed or delete) or mark to tree about this ?

Thank you.

0 votesVote for this answer Mark as a Correct answer

John Kane answered on November 3, 2016 15:36 (last edited on November 3, 2016 15:39)

The answer posted by Brenden Kehren answered on February 18, 2015 20:23 on this same thread works - the Kentico UI Wizard component basically uses various Kentico APIs (Table Manager, Document Class Info, FormInfo, FormFieldInfo, etc) to assemble a page type or a custom table definition correctly.

That Wizard's code can be traced through and copied & pasted to construct your Kentico object definition of choice.

I have been able to create a unit test based on the Wizard's code in which I new up Page Types (formerly Doc Types) on-the-fly by calling a method with a new namespace and codename, for headless testing purposes.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.