예제 #1
0
        public virtual string GetEditable(Context context, string key, EditableOptions options)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            using (var serviceContext = PortalViewContext.CreateServiceContext())
            {
                var attachedEntity   = serviceContext.MergeClone(Entity.Attributes.ContainsKey(key) ? Entity : FullEntity);
                var portalViewEntity = PortalViewContext.GetEntity(serviceContext, attachedEntity);

                IHtmlString html = null;

                context.Stack(() =>
                {
                    html = Html.AttributeInternal(
                        portalViewEntity.GetAttribute(key),
                        options.Type ?? "html",
                        options.Title,
                        options.Escape.GetValueOrDefault(false),
                        options.Tag ?? "div",
                        options.CssClass,
                        options.Liquid.GetValueOrDefault(true),
                        context,
                        options.Default);
                });

                return(html == null ? null : html.ToString());
            }
        }