示例#1
0
        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));
        }
示例#2
0
        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));
        }
示例#3
0
        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);
        }
示例#4
0
        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);
                    }
                }
            }
        }
示例#5
0
        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);
                    }
                }
            }
        }
示例#6
0
        public override void Process(HttpRequestArgs args)
        {
            var item = Spawn.FromItem <T>(Sitecore.Context.Item);

            OnProcess((T)((item is T) ? item : null), args);
        }