Class ComponentExtensions
- Namespace
- Dynamicweb.CoreUI.Rendering
- Assembly
- Dynamicweb.CoreUI.Rendering.dll
Extension methods for simplification of Dynamicweb component rendering
public static class ComponentExtensions
- Inheritance
-
ComponentExtensions
- Inherited Members
Methods
EncodePath(IHtmlHelper, string?)
public static string? EncodePath(this IHtmlHelper html, string? value)
Parameters
htmlIHtmlHelpervaluestring
Returns
EncodeUrl(IHtmlHelper, string?)
public static string? EncodeUrl(this IHtmlHelper html, string? url)
Parameters
htmlIHtmlHelperurlstring
Returns
GetImagePreview(IHtmlHelper, string)
public static string? GetImagePreview(this IHtmlHelper html, string filePath)
Parameters
htmlIHtmlHelperfilePathstring
Returns
GetImagePreview(IHtmlHelper, string, int, int)
public static string? GetImagePreview(this IHtmlHelper html, string filePath, int width, int height)
Parameters
htmlIHtmlHelperfilePathstringwidthintheightint
Returns
GetImagePreview(IHtmlHelper, string, int, int, long)
Returns a preview URL with a cache-busting version parameter appended.
Use version from Dynamicweb.Files.UI.Models.ImageFileDataModel.LastWriteTimeTicks
so the URL changes whenever the file is modified.
public static string? GetImagePreview(this IHtmlHelper html, string filePath, int width, int height, long version)
Parameters
htmlIHtmlHelperfilePathstringwidthintheightintversionlong
Returns
GetUniqueId(IHtmlHelper, object?)
public static string GetUniqueId(this IHtmlHelper _, object? model = null)
Parameters
_IHtmlHelpermodelobject
Returns
Icon(IViewComponentHelper, Icon?, Dictionary<string, string>?, Size)
public static Task<IHtmlContent?> Icon(this IViewComponentHelper viewComponentHelper, Icon? icon, Dictionary<string, string>? attributes = null, Size size = Size.Small)
Parameters
viewComponentHelperIViewComponentHelpericonIconattributesDictionary<string, string>sizeSize
Returns
RenderComponentPartial<TModel>(IHtmlHelper, string, TModel)
public static Task<IHtmlContent?> RenderComponentPartial<TModel>(this IHtmlHelper html, string partialName, TModel model)
Parameters
htmlIHtmlHelperpartialNamestringmodelTModel
Returns
Type Parameters
TModel
RenderComponentizedListOption(IHtmlHelper, ComponentizedListOption?)
public static Task<IHtmlContent?> RenderComponentizedListOption(this IHtmlHelper html, ListBase.ComponentizedListOption? option)
Parameters
htmlIHtmlHelperoptionListBase.ComponentizedListOption
Returns
RenderDynamicwebScreenWrapper(IViewComponentHelper, ScreenTypeBase)
public static Task<IHtmlContent?> RenderDynamicwebScreenWrapper(this IViewComponentHelper viewComponentHelper, ScreenTypeBase screenType)
Parameters
viewComponentHelperIViewComponentHelperscreenTypeScreenTypeBase
Returns
RenderDynamicwebUiComponent(IViewComponentHelper, UiComponentBase?)
Renders the passed Dynamicweb UiComponent as a model in a view with the same name as the fully qualified name of the viewmodel.
public static Task<IHtmlContent?> RenderDynamicwebUiComponent(this IViewComponentHelper viewComponentHelper, UiComponentBase? viewModel)
Parameters
viewComponentHelperIViewComponentHelperThe viewcomponent helper of the view calling this extension. This is an extension method
viewModelUiComponentBaseAn instance of a UiComponentBase model to be rendered
Returns
- Task<IHtmlContent>
A IHtmlContent response of the rendered model using the
Remarks
The view to render the model is located by convention. If the model is Text the view rendering the model is /Views/Shared/Components/UiComponentWrapper/Dynamicweb.CoreUI.Editors.Inputs.Text.cshtml
RenderDynamicwebUiComponent(IViewComponentHelper, UiComponentBase?, Dictionary<string, string>?)
public static Task<IHtmlContent?> RenderDynamicwebUiComponent(this IViewComponentHelper viewComponentHelper, UiComponentBase? viewModel, Dictionary<string, string>? attributes)
Parameters
viewComponentHelperIViewComponentHelperviewModelUiComponentBaseattributesDictionary<string, string>
Returns
ToJson(IHtmlHelper, object?, bool)
public static IHtmlContent ToJson(this IHtmlHelper html, object? input, bool useApiSerializerOptions = false)
Parameters
htmlIHtmlHelperinputobjectuseApiSerializerOptionsbool