Skip to content

Instantly share code, notes, and snippets.

@asmagin
Created June 22, 2014 13:56
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 asmagin/085b01c5c7e57fa72926 to your computer and use it in GitHub Desktop.
Save asmagin/085b01c5c7e57fa72926 to your computer and use it in GitHub Desktop.
DataSourceTokens
namespace IExamples.Sc.Pipelines.GetLookupSourceItems
{
using System.Linq;
using Sitecore.Data;
using Sitecore.Data.Fields;
using Sitecore.Data.Items;
using Sitecore.Diagnostics;
using Sitecore.Pipelines.GetLookupSourceItems;
public class DataSourceTokens
{
public void Process(GetLookupSourceItemsArgs args)
{
Assert.ArgumentNotNull(args, "args");
// Custom code to get value of dependency
var dependency = "some value";
// set default values for tokens
var token = dependency ?? "."
// replace tokens in datasource of the field
args.Source = args.Source
.Replace("{{token}}", token);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment