From 284732f0af87d6330d2dc322ae02ceeab608c5e9 Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Thu, 22 Jul 2010 23:01:57 -0700 Subject: [PATCH] Making BlogPost and Page content types "creatable"* during setup - *"creatable" name/concept subject to change --HG-- branch : dev --- .../Core/Contents/Extensions/MetaDataExtensions.cs | 9 +++++++++ src/Orchard.Web/Core/Orchard.Core.csproj | 1 + .../Modules/Orchard.Setup/Services/SetupService.cs | 7 +++++-- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 src/Orchard.Web/Core/Contents/Extensions/MetaDataExtensions.cs diff --git a/src/Orchard.Web/Core/Contents/Extensions/MetaDataExtensions.cs b/src/Orchard.Web/Core/Contents/Extensions/MetaDataExtensions.cs new file mode 100644 index 000000000..aeb2163d9 --- /dev/null +++ b/src/Orchard.Web/Core/Contents/Extensions/MetaDataExtensions.cs @@ -0,0 +1,9 @@ +using Orchard.ContentManagement.MetaData.Builders; + +namespace Orchard.Core.Contents.Extensions { + public static class MetaDataExtensions { + public static ContentTypeDefinitionBuilder Creatable(this ContentTypeDefinitionBuilder builder, bool creatable = true) { + return builder.WithSetting("ContentTypeSettings.Creatable", creatable.ToString()); + } + } +} diff --git a/src/Orchard.Web/Core/Orchard.Core.csproj b/src/Orchard.Web/Core/Orchard.Core.csproj index 1dad02d92..fef5f3e40 100644 --- a/src/Orchard.Web/Core/Orchard.Core.csproj +++ b/src/Orchard.Web/Core/Orchard.Core.csproj @@ -81,6 +81,7 @@ + diff --git a/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs b/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs index 11ec469f5..58e1543ce 100644 --- a/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs +++ b/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs @@ -6,6 +6,7 @@ using Orchard.ContentManagement; using Orchard.ContentManagement.MetaData; using Orchard.Core.Common.Models; using Orchard.Core.Common.Settings; +using Orchard.Core.Contents.Extensions; using Orchard.Core.Navigation.Models; using Orchard.Core.Routable.Models; using Orchard.Core.Settings.Descriptor.Records; @@ -192,8 +193,9 @@ namespace Orchard.Setup.Services { contentDefinitionManager.AlterTypeDefinition("BlogPost", cfg => cfg .DisplayedAs("Blog Post") .WithPart("CommentsPart") - .WithPart("HasTags") + .WithPart("TagsPart") .WithPart("Localized") + .Creatable() .Indexed()); contentDefinitionManager.AlterTypeDefinition("Page", cfg => cfg .DisplayedAs("Page") @@ -202,8 +204,9 @@ namespace Orchard.Setup.Services { .WithPart("IsRoutable") .WithPart("BodyPart") .WithPart("CommentsPart") - .WithPart("HasTags") + .WithPart("TagsPart") .WithPart("Localized") + .Creatable() .Indexed()); contentDefinitionManager.AlterPartDefinition("BodyPart", cfg => cfg .WithSetting("BodyPartSettings.FlavorDefault", BodyPartSettings.FlavorDefaultDefault));