Reputation: 75
As I have been creating my own Orchard module I decided that I needed a couple of taxonomies via the AlterPartDefinition method in the ContentDefinitionManager(I've been following the Advanced Orchard course on Pluralsight) class. I later decided that I actually didn't need 3 taxonomies and now I wish to remove a couple of them. Below is some code how I added them.
public int UpdateFrom10()
{
ContentDefinitionManager.AlterPartDefinition("ExercisePart", builder =>
builder.WithField("Category", lvl => lvl.OfType("TaxonomyField")
.WithSetting("DisplayName", "Category")
.WithSetting("TaxonomyFieldSettings.Taxonomy", "Category")
.WithSetting("TaxonomyFieldSettings.LeavesOnly", "False")
.WithSetting("TaxonomyFieldSettings.SingleChoice", "False")
.WithSetting("TaxonomyFieldSettings.Hint", "Select the category")
));
return 11;
}
How can I achieve my goal?
This is the course for those of you with access to pluralsight https://app.pluralsight.com/library/courses/adv-orchard/table-of-contents
Upvotes: 1
Views: 78
Reputation: 824
Pretty simple
ContentDefinitionManager.AlterPartDefinition("ExercisePart", builder =>
builder.RemoveField("Category"));
Upvotes: 4