mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Making BlogPost and Page content types "creatable"* during setup
- *"creatable" name/concept subject to change --HG-- branch : dev
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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" />
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user