public void Compose(ContentAreaRenderingContext context, TagBuilder tagBuilder)
 {
     foreach (var item in _registry)
     {
         item.Apply(context, tagBuilder);
     }
 }
예제 #2
0
 public void Apply(ContentAreaRenderingContext context, TagBuilder tagBuilder)
 {
     if (ShouldApply(context, tagBuilder))
     {
         ApplyCore(context, tagBuilder);
     }
 }
        protected virtual void ApplyCore(ContentAreaRenderingContext context, TagBuilder tagBuilder, string viewDataKey)
        {
            var attributes = context.ViewData[viewDataKey];

            if (attributes == null)
            {
                return;
            }

            tagBuilder.MergeAttributes(new RouteValueDictionary(attributes));
        }
 public virtual void Apply(ContentAreaRenderingContext context, TagBuilder tagBuilder)
 {
     if (context.IsRenderingContentArea())
     {
         ApplyCore(context, tagBuilder, "customattributes");
     }
     else if (context.IsRenderingContentAreaItem())
     {
         ApplyCore(context, tagBuilder, "childrencustomattributes");
     }
 }
예제 #5
0
 protected abstract bool ShouldApply(ContentAreaRenderingContext context, TagBuilder tagBuilder);
예제 #6
0
 protected abstract void ApplyCore(ContentAreaRenderingContext context, TagBuilder tagBuilder);
 protected override bool ShouldApply(ContentAreaRenderingContext context, TagBuilder tagBuilder)
 {
     return(context.IsRenderingContentArea());
 }
 protected virtual void ApplyCore(ContentAreaRenderingContext context, TagBuilder tagBuilder)
 {
     var tag = GetContentAreaItemTemplateTag(context.ViewData, context.CurrentItemDisplayOption);
     tagBuilder.AddCssClass(string.Format($@"block {GetTypeSpecificClasses(context.CurrentItemContent)} {GetCssClassForTag(tag)} {tag}"));
 }
 public void Apply(ContentAreaRenderingContext context, TagBuilder tagBuilder)
 {
     if(context.IsRenderingContentAreaItem())
         ApplyCore(context, tagBuilder);
 }