mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-22 20:13:50 +08:00
#17177: Moving content wrappers to features
Work Item: 17177 --HG-- branch : 1.x
This commit is contained in:
19
src/Orchard.Web/Core/Contents/ControlWrapper.cs
Normal file
19
src/Orchard.Web/Core/Contents/ControlWrapper.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Orchard.DisplayManagement.Descriptors;
|
||||
using Orchard.Environment.Extensions;
|
||||
|
||||
namespace Orchard.Core.Contents {
|
||||
[OrchardFeature("Contents.ControlWrapper")]
|
||||
public class ControlWrapper : IShapeTableProvider {
|
||||
public void Discover(ShapeTableBuilder builder) {
|
||||
builder.Describe("Content").OnDisplaying(displaying => {
|
||||
if (!displaying.ShapeMetadata.DisplayType.Contains("Admin")) {
|
||||
displaying.ShapeMetadata.Wrappers.Add("Content_ControlWrapper");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@@ -15,3 +15,8 @@ Features:
|
||||
Description: Rules for the Contents modules
|
||||
Category: Rules
|
||||
Dependencies: Orchard.Rules, Contents
|
||||
Contents.ControlWrapper:
|
||||
Name: Content Control Wrapper
|
||||
Description: Add an Edit button on the front-end for authenticated users
|
||||
Category: Content
|
||||
Dependencies: Contents
|
||||
|
@@ -29,9 +29,6 @@ namespace Orchard.Core.Contents {
|
||||
|
||||
// Content_[DisplayType]__[Id] e.g. Content-42.Summary
|
||||
displaying.ShapeMetadata.Alternates.Add("Content_" + displaying.ShapeMetadata.DisplayType + "__" + contentItem.Id);
|
||||
|
||||
if ( !displaying.ShapeMetadata.DisplayType.Contains("Admin") )
|
||||
displaying.ShapeMetadata.Wrappers.Add("Content_ControlWrapper");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -105,6 +105,7 @@
|
||||
<Compile Include="Containers\ViewModels\ContainableViewModel.cs" />
|
||||
<Compile Include="Containers\ViewModels\ContainerWidgetViewModel.cs" />
|
||||
<Compile Include="Containers\ViewModels\ContainerViewModel.cs" />
|
||||
<Compile Include="Contents\ControlWrapper.cs" />
|
||||
<Compile Include="Contents\Handlers\RulesHandler.cs" />
|
||||
<Compile Include="Contents\Rules\ContentEvents.cs" />
|
||||
<Compile Include="Contents\Rules\ContentForms.cs" />
|
||||
|
Reference in New Issue
Block a user