Instead of going and overriding the different Sitecore Publishing Processors, you may achieve it in a simpler way.
You will need to keep your custom checkbox on the Publishing Dialog and then, when the user clicks on the Publish button, you retrieve the value of the custom checkbox.
Once you see if the checkbox is checked, you store it on an item. You need to add a handler to the publish:itemProcessing
. From there you can check if the value of the checkbox on the item is checked or not.
public void OnItemProcessed(object sender, EventArgs args)
{
var itemArgs = args as ItemProcessedEventArgs;
if (itemArgs != null)
{
var publishContext = itemArgs.Context.PublishContext;
// Your Logic here
}
}
For performance gain, you can put the value into a custom cache and using the job handle, you will know if the job is completed or not. When the job is completed, you need to clear the custom cache so that for the next publish, it needs to retrieve the latest value.
This method will only require an update on the Publishing Dialog which you already did. It will not require the overriding of other processors.
You can read my post here for more information on how I used the event publish:itemProcessed
.