mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-01-19 17:51:45 +08:00
Add a "OnUnpublish" event to content handlers
Work Item: 16856 --HG-- branch : dev
This commit is contained in:
@@ -49,14 +49,14 @@ namespace Orchard.Core.Routable.Handlers {
|
||||
OnGetEditorShape<RoutePart>(SetModelProperties);
|
||||
OnUpdateEditorShape<RoutePart>(SetModelProperties);
|
||||
|
||||
OnPublished<RoutePart>((context, route) => {
|
||||
Action<PublishContentContext, RoutePart> handler = (context, route) => {
|
||||
FinalizePath(route, context, processSlug);
|
||||
|
||||
if (route.Id != 0 && route.PromoteToHomePage && _routableHomePageProvider != null) {
|
||||
var homePageSetting = _workContextAccessor.GetContext().CurrentSite.HomePage;
|
||||
var currentHomePageId = !string.IsNullOrWhiteSpace(homePageSetting)
|
||||
? _routableHomePageProvider.GetHomePageId(homePageSetting)
|
||||
: 0;
|
||||
? _routableHomePageProvider.GetHomePageId(homePageSetting)
|
||||
: 0;
|
||||
|
||||
if (currentHomePageId != route.Id) {
|
||||
// reset the path on the current home page
|
||||
@@ -73,7 +73,9 @@ namespace Orchard.Core.Routable.Handlers {
|
||||
_routableService.FixContainedPaths(route);
|
||||
_routablePathConstraint.AddPath(route.Path);
|
||||
}
|
||||
});
|
||||
};
|
||||
OnPublished<RoutePart>(handler);
|
||||
OnUnpublished<RoutePart>(handler);
|
||||
|
||||
OnRemoved<RoutePart>((context, route) => {
|
||||
if (!string.IsNullOrWhiteSpace(route.Path))
|
||||
|
||||
Reference in New Issue
Block a user