Open petrsvihlik opened 3 years ago
It looks like this new approach might resolve this as the IContentLinkUrlResolver
moves from ModelProvider
to HtmlResolver
,
But currently, because the IContentLinkUrlResolver
is instantiated via DI in the ModelProvider
, which is in turn used by the DeliveryClient
, Its currently impossible to have a IDeliveryClient
instance injected within a custom IContentLinkUrlResolver
implementation (it creates a circular dependency), eg;
public class CustomContentLinkUrlResolver : IContentLinkUrlResolver
{
public CustomContentLinkUrlResolver(IDeliveryClient client)
{
}
}
which in our case we want, (and I would think is a pretty general requirement?) to query Kontent's subpages hierarchy and build the url for a particular content item passed to the Url Resolver.
Thanks for pointing this out, we will take this into consideration.
Theme:
Goals:
IRichTextContent
was an early attempt to achieve that but it's far from complete)All related issues: https://github.com/Kentico/kontent-delivery-sdk-net/labels/rich-text
Supported scenarios:
Current solution:
IRichTextContent
-based - an object-like approach that combines hierarchical approach (for inline content items and assets) and string-based HTML rendering (for links)Proposed solution:
IRichTextContent
be the default type for rich-text elements and provide an additional layer for flattening it to a string.Detailed proposition:
RichTextContentConverter
part of theModelProvider
RichTextContentConverter
to treat links as objects (=do not apply string-based resolution) => links, assets, inline content items will be treated the same - as objectsContentLinkResolver
,ContentAssetResolver
,InlineContentItemResolver
public string ResolveToString(T model)
-> ability to flatten the object to stringpublic T Resolve(T model)
-> ability to adjust model's properties--structuredmodel
option from the code generator and leave it true by defaultExample code: