Skip to content

Instantly share code, notes, and snippets.

@trnktms
Last active March 20, 2018 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trnktms/42a068b4d2fd2aa96a29f90497127b69 to your computer and use it in GitHub Desktop.
Save trnktms/42a068b4d2fd2aa96a29f90497127b69 to your computer and use it in GitHub Desktop.
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