Created
June 22, 2014 13:56
-
-
Save asmagin/085b01c5c7e57fa72926 to your computer and use it in GitHub Desktop.
DataSourceTokens
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
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