Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8948893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:06:44+00:00 2026-06-15T13:06:44+00:00

I would like to create a custom Package content type in Orchard 1.6. I

  • 0

I would like to create a custom Package content type in Orchard 1.6. I already have a content part that represents the whole db record and UI for a Package, but now I’m wondering if I am going about this correctly.

It seems to me the next step is to use Orchard dashboard to create a new content type, and add my custom content part to the type. But, then the content type is internal to Orchard, with a dependency on my ‘external’ module that hosts the content part. How can I make it so that my content type is only available when my module is enabled?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:06:45+00:00Added an answer on June 15, 2026 at 1:06 pm

    For convenience, you could create the content type as part of one of the migrations in your module. This would only run when enabled. It would look something like this…

       //Inside of your migration file... 
       public int UpdateFrom1(){
         ContentDefinitionManager.AlterTypeDefinition("Package", cfg=> cfg
            .Creatable()
            .WithPart("YourCustomPart")
            .WithPart("CommonPart")
            .WithPart("Whatever other parts you want..."));
            return 2;
       }
    

    Removing this content type when you disable your module would be the tricky part because it might be kind of unexpected by the user. Maybe “Package” is a type they still want to use with different parts attached. Also, if they manually delete your module without disabling, you can’t really write code to respond to that event. The only reliable thing I know of is the IFeatureEventHandler. This would allow you to remove your content type if they disable the module in the admin…

    public PackageRemover : IFeatureEventHandler {
      private readonly IContentDefinitionManager _contentDefinitionManager;
      public PackageRemover(IContentDefinitionManager contentDefinitionManager){
        _contentDefinitionManager = contentDefinitionManager;
      }
    
      public void Installed(Feature feature){}
      public void Enabling(Feature feature){}
      public void Enabled(Feature feature){}
      public void Disabling(Feature feature){
        _contentDefinitionManager.DeleteTypeDefinition("Package");
      }
      public void Disabled(Feature feature){}
      public void Uninstalling(Feature feature){}
      public void Uninstalled(Feature feature){}
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have authored some custom classes that I would like to create using XAML:
I would like to create a custom data type which basically behaves like an
I would like to create a c++ type that mimic the build-in type exactly.
I have an XNA 3.1 program and would like to create an installer that
I would like to create a custom control in order to display a pie
I would like to create a custom document library where I use the standard
I would like to create a custom control in my Android App. It will
i would like create a array of structure which have a dynamic array :
Hi i made a custom class where i would like to create x instances
I would like to create custom SEO friendly routes similar to what is used

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.