public void Process(SitecoreResourceManagerArgs args) { for (int i = 0; i < 4; i++) { foreach (var prop in args.GetAllProperties()) { args[prop.Key] = ReplaceAllTokens.ReplaceTokens(prop.Value, args, prop.Key); } } }
public ActionResult Execute(ExecuteModel model) { var collectors = _scanner.ScanForImplementsInterface <IPropertyCollector>().ToDictionary(x => x.Processor); var propertiesWrapper = _registration.GetScsRegistration <ScsSitecoreResourceManagerRegistration>().GetPropertiesWrapper(model.Template); var propertyDictionary = model.Properties.ToDictionary(x => x.Id); foreach (var prop in model.Properties) { if (propertyDictionary[prop.Id].Value == null) { continue; } if (!string.IsNullOrWhiteSpace(prop.Processor) && !collectors[prop.Processor].Validate(prop.Value)) { return(Content(prop.Name)); } propertyDictionary[prop.Id].Value = ReplaceAllTokens.ReplaceTokens(propertyDictionary[prop.Id].Value, propertyDictionary.ContainsKey, x => propertyDictionary[x].Value); if (propertiesWrapper.Targets[model.Target].ContainsKey(prop.Id) && propertiesWrapper.Targets[model.Target][prop.Id] == "???") { _savedProps[$"{model.Target}.{prop.Id}", model.Template] = prop.Value; } if (propertiesWrapper.Properties.ContainsKey(prop.Id) && propertiesWrapper.Properties[prop.Id].Remember) { _savedProps[$"{model.Target}.{prop.Id}", model.Template] = prop.Value; } } var args = new SitecoreResourceManagerArgs(propertyDictionary, propertiesWrapper); var pipeline = CorePipelineFactory.GetPipeline("propertyProcessorPreCompiled", string.Empty); pipeline.Run(args); foreach (string compilePropertyKey in propertiesWrapper.CompiledProperties.Keys) { args[compilePropertyKey] = ReplaceAllTokens.ReplaceTokens(propertiesWrapper.CompiledProperties[compilePropertyKey], propertyDictionary.ContainsKey, x => propertyDictionary[x].Value); } pipeline = CorePipelineFactory.GetPipeline("propertyProcessorPostCompiled", string.Empty); pipeline.Run(args); pipeline = CorePipelineFactory.GetPipeline("SitecoreResourceManager", string.Empty); pipeline.Run(args); return(ScsJson(args.Output)); }