C# Class Sdl.Web.Common.Models.MediaItem

Inheritance: EntityModel
Mostrar archivo Open project: sdl/dxa-web-application-dotnet Class Usage Examples

Protected Properties

Property Type Description
FontAwesomeMimeTypeToIconClassMapping string>.IDictionary

Private Properties

Property Type Description

Public Methods

Method Description
GetFriendlyFileSize ( ) : string

Gets the file size with units.

GetIconClass ( ) : string

Gets the name of a CSS class representing the Icon for this Media Item.

ReadFromXhtmlElement ( XmlElement xhtmlElement ) : void

Read properties from XHTML element.

ToHtml ( ) : string

Renders an HTML representation of the Entity Model.

This method is used when the Entity Model is part of a RichText instance which is mapped to a string property. In this case HTML rendering happens during model mapping, which is not ideal. Preferably, the model property should be of type RichText and the View should use @Html.DxaRichText() to get the rich text rendered as HTML.

ToHtml ( string widthFactor, double aspect, string cssClass = null, int containerSize ) : string

Renders an HTML representation of the Media Item.

This method is used by the IRichTextFragment.ToHtml() implementation and by the HtmlHelperExtensions.Media implementation. Both cases should be avoided, since HTML rendering should be done in View code rather than in Model code.

Method Details

GetFriendlyFileSize() public method

Gets the file size with units.
public GetFriendlyFileSize ( ) : string
return string

GetIconClass() public method

Gets the name of a CSS class representing the Icon for this Media Item.
public GetIconClass ( ) : string
return string

ReadFromXhtmlElement() public method

Read properties from XHTML element.
public ReadFromXhtmlElement ( XmlElement xhtmlElement ) : void
xhtmlElement System.Xml.XmlElement XHTML element
return void

ToHtml() public method

Renders an HTML representation of the Entity Model.
This method is used when the Entity Model is part of a RichText instance which is mapped to a string property. In this case HTML rendering happens during model mapping, which is not ideal. Preferably, the model property should be of type RichText and the View should use @Html.DxaRichText() to get the rich text rendered as HTML.
public ToHtml ( ) : string
return string

ToHtml() public abstract method

Renders an HTML representation of the Media Item.
This method is used by the IRichTextFragment.ToHtml() implementation and by the HtmlHelperExtensions.Media implementation. Both cases should be avoided, since HTML rendering should be done in View code rather than in Model code.
public abstract ToHtml ( string widthFactor, double aspect, string cssClass = null, int containerSize ) : string
widthFactor string The factor to apply to the width - can be % (eg "100%") or absolute (eg "120").
aspect double The aspect ratio to apply.
cssClass string Optional CSS class name(s) to apply.
containerSize int The size (in grid column units) of the containing element.
return string

Property Details

FontAwesomeMimeTypeToIconClassMapping protected_oe static_oe property

protected static IDictionary FontAwesomeMimeTypeToIconClassMapping
return string>.IDictionary