Take the community feedback survey now.
AI OnAI Off
Take the community feedback survey now.
You could intercept IContentCopyHandler and pass in false for parameter "publishOnDestination" as:
[ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
public class CheckedOutCopyInitializableModule : IConfigurableModule
{
public void ConfigureContainer(ServiceConfigurationContext context)
{
context.Services.Intercept<IContentCopyHandler>((locator, defaultCopyHandler) => new CheckedOutContentCopyHandler(defaultCopyHandler));
}
public void Initialize(InitializationEngine context)
{}
public void Uninitialize(InitializationEngine context)
{}
}
public class CheckedOutContentCopyHandler : IContentCopyHandler
{
private readonly IContentCopyHandler _defaultHandler;
public CheckedOutContentCopyHandler(IContentCopyHandler defaultHandler)
{
_defaultHandler = defaultHandler;
}
public ContentReference Copy(ContentReference contentLink, ContentReference destinationLink, AccessLevel requiredSourceAccess, bool publishOnDestination)
{
return _defaultHandler.Copy(contentLink, destinationLink, requiredSourceAccess, false);
}
}
When I copy and paste a page in the tree its status is always published or maybe it is the same of the page it is being copied from. I want to make the status of that page unpublished by default and then publish is manually later on. Is it possible?