Making BlogPost and Page content types "creatable"* during setup

- *"creatable" name/concept subject to change

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-07-22 23:01:57 -07:00
parent edd312f539
commit 284732f0af
3 changed files with 15 additions and 2 deletions

View File

@@ -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());
}
}
}

View File

@@ -81,6 +81,7 @@
<Compile Include="Common\ViewModels\TextContentFieldEditorViewModel.cs" />
<Compile Include="Contents\Controllers\ItemController.cs" />
<Compile Include="Contents\Drivers\ContentsDriver.cs" />
<Compile Include="Contents\Extensions\MetaDataExtensions.cs" />
<Compile Include="Contents\Handlers\ContentsHandler.cs" />
<Compile Include="Contents\Permissions.cs" />
<Compile Include="Contents\Routes.cs" />

View File

@@ -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));