Post type import

Håkan Edling edited this page May 7, 2015 · 1 revision

Just as with pages, post types can be imported from code files. You can read more on the benefits with this approach on the page Page types.

Declaring a post type

Post types are imported automatically on application startup by MEF and created in the database if they are missing.

using System;
using System.ComponentModel.Composition;
using Piranha.Extend;

/// <summary>
/// Blog post
/// </summary>
[Export(typeof(IPostType))]
public class BlogPost : PostType
{
  public BlogPost() {
    Name = "BlogPost" ;
    Description = "Blog post entry" ;
    Controller = "BlogPost" ;
  }
}
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.