/// <summary> /// Generates semantic markup (HTML/RDFa attributes) for a given property of a given Entity Model. /// </summary> /// <param name="htmlHelper">The HtmlHelper instance on which the extension method operates.</param> /// <param name="entity">The Entity Model.</param> /// <param name="propertyName">The name of the property.</param> /// <param name="index">The index of the property value (for multi-value properties).</param> /// <returns>The semantic markup (HTML/RDFa attributes).</returns> public static MvcHtmlString DxaPropertyMarkup(this HtmlHelper htmlHelper, EntityModel entity, string propertyName, int index = 0) { return(Markup.RenderPropertyAttributes(entity, propertyName, index)); }
/// <summary> /// Generates semantic markup (HTML/RDFa attributes) for a given Region Model. /// </summary> /// <param name="htmlHelper">The HtmlHelper instance on which the extension method operates.</param> /// <param name="region">The Region Model to generate semantic markup for.</param> /// <returns>The HTML/RDFa attributes for the Region. These should be included in an HTML start tag.</returns> public static MvcHtmlString DxaRegionMarkup(this HtmlHelper htmlHelper, RegionModel region) { return(Markup.RenderRegionAttributes(region)); }
/// <summary> /// Generates semantic markup (HTML/RDFa attributes) for a given Entity Model. /// </summary> /// <param name="htmlHelper">The HtmlHelper instance on which the extension method operates.</param> /// <param name="entity">The Entity Model to generate semantic markup for.</param> /// <returns>The HTML/RDFa attributes for the Entity. These should be included in an HTML start tag.</returns> public static MvcHtmlString DxaEntityMarkup(this HtmlHelper htmlHelper, EntityModel entity) { return(Markup.RenderEntityAttributes(entity)); }
/// <summary> /// Generates semantic markup (HTML/RDFa attributes) for a given property of the current Entity Model. /// </summary> /// <param name="htmlHelper">The HtmlHelper instance on which the extension method operates.</param> /// <param name="propertyName">The name of the property.</param> /// <param name="index">The index of the property value (for multi-value properties).</param> /// <returns>The semantic markup (HTML/RDFa attributes).</returns> public static MvcHtmlString DxaPropertyMarkup(this HtmlHelper htmlHelper, string propertyName, int index = 0) => Markup.RenderPropertyAttributes((EntityModel)htmlHelper.ViewData.Model, propertyName, index);