When you write an <addFromTemplate>
pipeline processor, you are actually replacing the default behavior of the ItemProvider.AddFromTemplate
method. Every ItemProvider
pipeline sends in the native ItemProvider
as the args.FallbackProvider
. As such, when you call the following, what you are actually doing is analogous to base.AddFromTemplate
, wherein you are calling the native logic within your "overriding" (sort of - this isn't really the right term) method:
// analogous to base.AddFromTemplate
var item = args.FallbackProvider.AddFromTemplate(args.ItemName, args.TemplateId, args.Destination, args.NewId);
Since you are writing a processor, the only way to return a result is by setting a property on your Pipeline arguments. As such, we "return" (sort of - again, this isn't really the right term) a result by setting the args.Result
property. Additionally, if there are any other processors then they should use the "result" of this processor instead of the item this processor started with as the args.ProcessorItem
:
args.ProcessorItem = // any other processors should use this item
args.Result = item; // this is the result
More Information: