예제 #1
0
 private static void BuildImage(IComponent image, object htmlAttributes, TagBuilder builder)
 {
     builder.MergeAttribute("src", image.GetImageURL());
     builder.MergeAttribute("alt", image.GetImageAltText());
     builder.MergeAttributes<string, object>(new RouteValueDictionary(htmlAttributes));
     if (image.MetadataFields.ContainsKey("defaultMetadata") && image.MetadataFields["defaultMetadata"].EmbeddedValues[0].ContainsKey("title"))
     {
         builder.MergeAttribute("title", image.MetadataFields["defaultMetadata"].EmbeddedValues[0]["title"].Value);
         if (string.IsNullOrEmpty(builder.Attributes["alt"]))
         {
             builder.MergeAttribute("alt", image.MetadataFields["defaultMetadata"].EmbeddedValues[0]["title"].Value, true);
         }
     }
 }