Add a "OnUnpublish" event to content handlers

Work Item: 16856

--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-12-02 20:30:13 -08:00
parent d336bfa6cf
commit cc44d1d7dd
12 changed files with 72 additions and 12 deletions

View File

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