/// <summary> /// Gets the control data. /// /// </summary> /// <param name="reference">The reference.</param><param name="item">The item.</param> /// <returns> /// The chrome data. /// </returns> public static ChromeData GetControlData(RenderingReference reference, Item item) { Assert.ArgumentNotNull((object)reference, "reference"); Assert.ArgumentNotNull((object)item, "item"); Item obj = item; if (!string.IsNullOrEmpty(reference.Settings.DataSource)) { if (MainUtil.IsFullPath(reference.Settings.DataSource)) { if (Sitecore.Context.Database != null) { obj = Sitecore.Context.Database.GetItem(reference.Settings.DataSource); } } else { obj = item.Axes.GetItem(reference.Settings.DataSource); } } GetChromeDataArgs args = new GetChromeDataArgs("rendering", obj ?? item); args.CustomData["renderingReference"] = (object)reference; GetChromeDataPipeline.Run(args); return(args.ChromeData); }
protected override Item GetDataItem(PrintContext printContext) { Item result = null; string dataSource = this.DataSource; if (dataSource.Length > 0) { if (MainUtil.IsFullPath(dataSource)) { Item dataItem = printContext.Database.GetItem(dataSource); Field lookupfield = dataItem.Fields[this.LookupField]; // this is the contributors field String lookupfieldvalue = lookupfield.Value; Item lookupItem = printContext.Database.GetItem(lookupfieldvalue); result = lookupItem; } else { result = this.RenderingItem.Axes.GetItem(dataSource); } } return(result); }