/// <summary> /// Add an icon /// </summary> /// <typeparam name="T">Generic type to be used. This type must implement IExtendedHtmlString</typeparam> /// <param name="html">Current html element</param> /// <param name="icon">Icon to be rendered</param> /// <param name="htmlAttributes">[Optional] Extra html attributes</param> /// <returns>Html element with icon added</returns> /// <exception cref="BootstrapVersionException"> /// Thrown when a valid Bootstrap version /// is not selected /// </exception> public static T AddIcon <T>(this T html, EBootstrapIcon icon, object htmlAttributes = null) where T : IExtendedHtmlString { html = AddIcon(html, new[] { icon.GetStringValue() }, htmlAttributes); return(html); }
/// <summary> /// Add a white icon /// </summary> /// <typeparam name="T">Generic type to be used. This type must implement IExtendedHtmlString</typeparam> /// <param name="html">Current html element</param> /// <param name="icon">Icon to be rendered</param> /// <param name="htmlAttributes">[Optional] Extra html attributes</param> /// <returns>Html element with a white icon added</returns> /// <exception cref="BootstrapVersionException"> /// Thrown when a valid Bootstrap version /// is not selected /// </exception> public static T AddWhiteIcon <T>(this T html, EBootstrapIcon icon, object htmlAttributes = null) where T : IExtendedHtmlString { switch (WebExtrasSettings.BootstrapVersion) { case EBootstrapVersion.V2: break; case EBootstrapVersion.V3: throw new InvalidOperationException( "Since Bootstrap v3, all icons are font based. Therefore, you must use CSS styling to control icon color"); default: throw new BootstrapVersionException(); } html = AddIcon(html, new[] { "icon-white " + icon.GetStringValue() }, htmlAttributes); return(html); }