I've never heard of PropertyValueConverters up until now, nor have I used the Newtonsoft.Json package before, so I'm kinda lost on how to get further with this.
I can verify that Frans solution works. I just created my own from his example.
So instead of inherit from the interface IPropertyValueConverter you inherit from the abstract class PropertyValueConverterBase and only override what you need.
Rendering custom property editor in v8
Hi guys
I'm trying to get my v7 custom property editor to work in v8, but having some problems.
My v7 view looks like this:
I know CurrentPage isn't in v8 anymore, so tried changing it to
Model.Value("metaRobots")
andModel.Value("seoMeta")
But I get this error:
CS1061: 'object' does not contain a definition for 'robots'
Can anyone point me in the right direction of how I render this property editor in my view?
Best
Henrik
And then you need a PropertyValueConverter.
Otherwise, use
Value<string>("meatRobots")
and parse the json withJsonConvert
in the Newtonsoft.Json package (already in umbraco).Thanks Søren
Is
<YourOwnRobotsObj>
the name of my datatype or the Property Editor Alias?Henrik
that is a model that represents the data your editor saves :)
To complete this answer here's a link to the documentation on Property value converters: https://our.umbraco.com/Documentation/Extending/Property-Editors/value-converters
Thanks to the both of you.
I've never heard of PropertyValueConverters up until now, nor have I used the Newtonsoft.Json package before, so I'm kinda lost on how to get further with this.
This is my controller:
And this my view:
Which of the solutions, would you suggest me to go with, with this setup.
Hope you can give me the last push in the right direction :)
Best
Henrik
Hi Henrik.
Its a bit confusing because Umbraco havent updated the documentation for Umbraco 8 at https://our.umbraco.com/Documentation/Extending/Property-Editors/value-converters and i am still trying myself to figure the new way out
Umbraco 7 worked this way.
The Umbraco 8 way, Maybe this link can help you further https://our.umbraco.com/apidocs/v8/csharp/api/Umbraco.Core.PropertyEditors.IPropertyValueConverter.html
Here's one I made for a simple string propertytype:
Should be self explanatory? Otherwise please ask ;)
I can verify that Frans solution works. I just created my own from his example.
So instead of inherit from the interface IPropertyValueConverter you inherit from the abstract class PropertyValueConverterBase and only override what you need.
is working on a reply...