Created
May 28, 2015 14:00
-
-
Save mskutta/a617a2d9c70fda96680e to your computer and use it in GitHub Desktop.
EvaluateAction PublishItemProcessor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EvaluateAction : PublishItemProcessor | |
{ | |
public override void Process(PublishItemContext context) | |
{ | |
Assert.ArgumentNotNull(context, "context"); | |
// We just want to process deletes because this is the only time the item being deleted may exist. | |
if (context.Action != PublishAction.DeleteTargetItem && context.Action != PublishAction.PublishSharedFields) | |
return; | |
// Attempt to find the item. If not found, item has already been deleted. This can occur when more than one langauge is published. The first language will delete the item. | |
var item = context.PublishHelper.GetTargetItem(context.ItemId) ?? | |
context.PublishHelper.GetSourceItem(context.ItemId); | |
if (item == null) | |
return; | |
// Hold onto the item for the EvaluateResult PublishItemProcessor. | |
context.CustomData.Add("Item", item); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment