Created
October 25, 2024 23:12
-
-
Save sitefinitySDK/2eda36581694e97617e91eadc7d5efa4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Threading.Tasks; | |
using Progress.Sitefinity.AspNetCore.Configuration; | |
using Progress.Sitefinity.RestSdk; | |
using Progress.Sitefinity.AspNetCore.Widgets.Models.ContentBlock; | |
using Progress.Sitefinity.AspNetCore.Widgets.ViewComponents.Common; | |
using Renderer.ViewModels; | |
using Renderer.Entities; | |
namespace Renderer.Models | |
{ | |
/// <summary> | |
/// Extended model for the ContentBlock view component. | |
/// </summary> | |
public class ExtendedContentBlockModel : ContentBlockModel | |
{ | |
/// <summary> | |
/// Initializes a new instance of the <see cref="ExtendedContentBlockModel"/> class. | |
/// </summary> | |
/// <param name="restClient">The HTTP client.</param> | |
/// <param name="styles">The style classes provider.</param> | |
public ExtendedContentBlockModel(IRestClient restClient, IStyleClassesProvider styles) | |
: base(restClient, styles) | |
{ | |
} | |
/// <summary> | |
/// Initializes the view model. | |
/// </summary> | |
/// <param name="context">The context.</param> | |
/// <returns>The view model.</returns> | |
public override async Task<ContentBlockViewModel> InitializeViewModel(ContentBlockEntity entity) | |
{ | |
var viewModel = await base.InitializeViewModel(entity).ConfigureAwait(false); | |
return new ExtendedContentBlockViewModel(viewModel) | |
{ | |
ModifiedContent = viewModel.Content + (entity as ExtendedContentBlockEntity).TextToAppend | |
}; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment