Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using Sitecore;
using Sitecore.ExperienceEditor.Utils;
using Sitecore.ExperienceEditor.WebEdit.Commands;
using Sitecore.Workflows.Simple;
using System.Linq;
namespace Helix.Skeleton.Foundation.ContentWorkflow.Commands
{
public class WorkflowWithDatasourceItemsAndChildren : WorkflowWithDatasourceItems
{
protected new void WorkflowCompleteCallback(WorkflowPipelineArgs args)
{
base.WorkflowCompleteCallback(args);
var datasources = ItemUtility.GetItemsFromLayoutDefinedDatasources(
args.DataItem,
Context.Device,
args.DataItem.Language);
foreach (var child in ItemUtility.FilterSameItems(datasources).SelectMany(d => d.Children))
{
if (child.Access.CanWrite() && (!child.Locking.IsLocked() || child.Locking.HasLock()))
{
WorkflowUtility.ExecuteWorkflowCommandIfAvailable(
child,
args.CommandItem,
args.CommentFields);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment