Overview
This page contains a draft definition of the functionality that would be required to related to binding CMS data to View Models.
Current Implementations
DXA uses a IModelBuilder interface as follows, IModelBuilders are chained together in a ModelBuilderPipeline, to allow additional processing to be done after the basic model is built from CMS data (this is for example how the model is enriched with data from SmartTarget queries)
public interface IModelBuilder { void BuildPageModel(ref PageModel pageModel, IPage page, IEnumerable<IPage> includes, Localization localization); void BuildEntityModel(ref EntityModel entityModel, IComponentPresentation cp, Localization localization); void BuildEntityModel(ref EntityModel entityModel, IComponent component, Type baseModelType, Localization localization); }
DD4T.NET
TODO
DD4T.Java
TODO
Required Functionality
The View Models page contains an audit of existing DXA and DD4T functionality. This is distilled below into the following requirements table:
Ref | Prio | Description |
---|---|---|
Must have | The ModelBinder can bind Page and Entity (Component Presentation) Models from DD4T JSON | |
Must have | The ModelBinder can resolve regions from the set of CPs on the page | |
Must have | The logic for resolving regions is extensible using a IPageRegionResolver. The default behaviour is to resolve everything into a single region | |
Must have | A IPageRegionResolver which implements the DXA Region resolving logic will be provided | |
Must have | The ModelBinder can resolve fields which are component links into URLs | |
Must have | The logic for resolving links is extensible using an ILinkResolver | |
Must have | Model properties can be marked as 'dynamic' to prevent the link being resolved when the model is built | |
Must have | The ModelBinder can resolve Rich Text fields (resolving links and binaries) | |
Must have | The logic for resolving rich text is extensible using an IRichTextResolver | |
Must have | An implementation of the IRichTextResolver which implements the DXA Rich text resolving will be provided (splitting the RTF into a list of entities/html blocks) | |
Add Comment