AI OnAI Off
Your extension method looks quite similar to the method XhtmlRenderService.RenderXHTMLString(params) and it should work by default.
Which ContentDeliveryApi version are you using ?
Hi Quan,
Thanks for the reply.
We're using version 2.6.1 of the ContentDeliveryApi packages.
After troubleshooting some more, we found out that the block we were using in our XhtmlString property didn't have a corresponding view defined. That explains why the block's content didn't render in the response. Using a block having a corresponding view worked even without the custom property model.
- Thomas
Hi everyone,
Our team is building a single-page application retrieving content from EPiServer Content Delivery API. A key requirement from the editors is that they should be able to use blocks inside XhtmlString properties (TinyMCE text editor). We're having trouble getting content from blocks included in XhtmlString properties in our API's reponses.
We have tried combining the steps in the two following articles in order to override the default serialization of XhtmlString properties and render the blocks inside them by using EPiServer's "RenderXhtmlString" extension method for HtmlHelper instances.
Here are snippets of our code:
Custom property model for XhtmlString
Extension method "ConvertToExternal"
The extension method "ConvertToExternal" works as expected (by including content for blocks inside the XhtmlString) when using it in a traditional ASP.NET MVC EPiServer solution. However, it does not include any content from blocks when being used through EPiServer's Content Delivery API.
Any suggestion as to what we are doing wrong, or other solutions to our problem, is much appreciated.
- Thomas