Ejemplo n.º 1
0
        internal ResponseRendering AddRendering(Item contextItem, LayoutDefinition layoutDefinition, ResponseRendering responseRendering)
        {
            var placeholder = _Placeholders.SingleOrDefault(p => p.Name == responseRendering.PlaceholderName && (!p.Dynamic || p.ParentUniqueId == responseRendering.ParentUniqueId));

            if (placeholder == null)
            {
                // TODO: but this would be a NOT FOUND situation?
                // - basically this means that that placeholder wasn't really on that rendering
                // - or it is dynamic and not referenced dynamically!
                //var possiblePlaceholders = _Placeholders.Where(p => p.Dynamic && p.Name == responseRendering.PlaceholderName).ToList();
                //if (possiblePlaceholders.Count > 0) { // this means that we are dynamic, but we haven't built out our placeholder name with the guid, etc

                //	// TODO: what about seed?
                //	responseRendering.PossiblePlaceholderPaths.AddRange(possiblePlaceholders.Select(p => p.Name + "-" + p.ParentUniqueId)); // TODO: check if this causes any recursion problems?
                //	placeholder = new ResponsePlaceholder(contextItem, layoutDefinition, responseRendering.PlaceholderName, "", false, true);
                //} else {
                //}


                placeholder = new ResponsePlaceholder(contextItem, layoutDefinition, responseRendering.PlaceholderName, "", false, false);
                _Placeholders.Add(placeholder);
            }
            var rendering = placeholder.AddRendering(responseRendering);

            return(rendering);
        }
Ejemplo n.º 2
0
        internal ResponseRendering AddRendering(Item contextItem, LayoutDefinition layoutDefinition, ResponseRendering responseRendering)
        {
            var placeholder = _Placeholders.SingleOrDefault(p => p.Name == responseRendering.PlaceholderName && (!p.Dynamic || p.ParentUniqueId == responseRendering.ParentUniqueId));             // TODO: we're not using the seed here. But how can we?

            if (placeholder == null)
            {
                // TODO: but this would be a NOT FOUND situation?
                // - basically this means that that placeholder wasn't really on that rendering
                // - we
                // TODO: the real question is, why wasn't maincontent already added?
                // TODO: UniqueId isn't the Guid this goes into, it's the Guid of what this is. Or what happened to be the first one found! It needs to be PARENT
                placeholder = new ResponsePlaceholder(contextItem, layoutDefinition, responseRendering.PlaceholderName, ParentUniqueId, true);
                _Placeholders.Add(placeholder);
            }
            var rendering = placeholder.AddRendering(responseRendering);

            return(rendering);
        }