public override T GetTarget <T>() { if (IsInternal || IsMediaLink) { var wrapper = Spawn.FromItem <T>(LinkField.TargetItem); return((T)((wrapper is T) ? wrapper : null));; } return(default(T)); }
public virtual T GetTarget <T>() where T : IItemWrapper { var item = Sitecore.Context.Database.GetItem(RawValue); if (item != null) { var wrapper = Spawn.FromItem <T>(item); return((T)((wrapper is T) ? wrapper : null));; } return(default(T)); }
public void OnItemCreated(object sender, EventArgs args) { var eventArgs = args as SitecoreEventArgs; Assert.IsNotNull(eventArgs, "eventArgs"); var itemCreatedEventArgs = eventArgs.Parameters[0] as ItemCreatedEventArgs; Assert.IsNotNull(itemCreatedEventArgs, "itemCreatedEventArgs"); var scItem = itemCreatedEventArgs.Item; Assert.IsNotNull(scItem, "scItem"); var item = Spawn.FromItem <T>(scItem); OnItemCreated((T)((item is T) ? item : null), sender, (object)args); }
public IEnumerable <T> GetItems <T>() where T : IItemWrapper { var listField = (MultilistField)Field; foreach (var id in listField.Items) { var item = Sitecore.Context.Database.GetItem(id); if (item != null) { var wrapper = Spawn.FromItem <T>(item); if (wrapper is T) { yield return((T)wrapper); } } } }
public IEnumerable <T> GetItems <T>() where T : IItemWrapper { var list = Value.Split('|'); foreach (var id in list) { var item = Sitecore.Context.Database.GetItem(id); if (item != null) { var wrapper = Spawn.FromItem <T>(item); if (wrapper is T) { yield return((T)wrapper); } } } }
public override void Process(HttpRequestArgs args) { var item = Spawn.FromItem <T>(Sitecore.Context.Item); OnProcess((T)((item is T) ? item : null), args); }