asp.net-mvcorchardcmsorchard-modules

Orchard: Remove items from menu inside dashboard


I learning Orchard and I don't success to remove item from menu (inside dashboard not site), I use this guide for create new module Writing a Content Part.

My migration looks:

public int Create(){ // Creating table MapRecord SchemaBuilder.CreateTable("MapRecord", table => table .ContentPartRecord() .Column("Latitude", DbType.Double) .Column("Longitude", DbType.Double) ); ContentDefinitionManager.AlterPartDefinition( typeof(MapPart).Name, cfg => cfg.Attachable()); ContentDefinitionManager.AlterTypeDefinition("Map", builder => builder .WithPart("CommonPart") .WithPart("TitlePart") .WithPart("MapPart") .Creatable() .Draftable()); return 1; }

I have new item in menu

My new module works fine but now I want to remove the "Map" from the menu how I do it?

Edit for new user that read this post

Ok, I succeeded that related to content Types we can remove from site or from the code

That remove all "Map" type (like devqon said in comment)

public int UpdateFrom3()
        {
            ContentDefinitionManager.DeleteTypeDefinition("Map");

            return 4;
        }

better options we can unflag the Creatable()

    public int UpdateFrom3()
       {

             ContentDefinitionManager.AlterTypeDefinition("Map", builder =>
              builder
                  .WithPart("CommonPart")
                  .WithPart("TitlePart")
                  .WithPart("MapPart")
                  .Creatable(false)
                  .Draftable());

             return 4;
       }

Solution

  • This is caused by the creatable flag. Just remove it to get rid of the menu item, either in the migration by removing Creatable() or go to content types and untick the checkbox.