November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
If it's just one specific property that you want to add the query string parameters to, it might be better to just add it as a new property on the converted model it in the ExtendedContentModelMapper.cs (assuming you've used the Music Festival site as a template).
You could do it like this (in the TransformContent method, after contentModel is transformed:
if(content is YourPageType page)
{
var url = UrlResolver.Current.GetUrl(page.YourImageProperty);
var imageWithParams = $"{url}?v=xxxx&height=&width";
contentModel.Properties.Add("imagewithparams", imageWithParams);
}
Thanks, This solved my current issue. If I have more properties where I need modification, would I still use this method or do by implementing IpropertyModelConverter.
I am going to accept your answer.
I am also trying to strip out fields from ContentApiModel by overriding ContentResultService as mentioned in documentation (https://world.episerver.com/documentation/developer-guides/content-delivery-api/how-to-customize-data-returned-to-clients/) but it doesn't get triggered.
Do you happen to have any reference on how to get this done as well.?
We use IPropertyModelConverter when we need to tell the ContentModelMapper how to convert a custom property, so as long as what you're doing is to modify values of properties etc. you could still use this method.
As for your other question, did you register your custom service as per the documentation in the DependencyResolverInitalization-module?
Yes, I have registered in the dependency resolver. Have done all the steps as per the documentation. I also found a thread on similar issue
https://world.episerver.com/forum/developer-forum/-Episerver-75-CMS/Thread-Container/2019/1/contentresultservice-is-executed-instead-of-the-injected-one/
I also see quite a few overrides in DefaultContentConverter but honestly other than a couple, not really finding documentation on what those methods can really do.
Hello team,
Can someone help me with below issue?
I have a content delivery API and in response I have a field (for one of my pages) ContentReference for Images. I need to add some extension to the Image URL that comes back in JSON response (http:\\xyz.com..\..image.jpg to http:\\xyz.com..\..image.jpg?v=xxxx&height=&width)
I am trying to implement CustomPropertyModelConverter but am stuck on how to identify if the content reference is an image and how to update the ModelType.
Also am not sure if this is the correct way to do it? Can someone provide an example on how can I achieve this.