Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jeroen Wijdeven 31 posts 72 karma points MVP
    Dec 23, 2013 @ 17:06
    Jeroen Wijdeven
    0

    How to overrule a core PropertyValueConverter

    Because I like to return my own type of object for Related Links I wrote an IPropertyEditorValueConverter in v6. This implementation does not work anymore in v7 so currently I am changing this to a IPropertyValueConverter. But then I got this error:

    Type 'Implementation.Converters.RelatedLinks' cannot be an IPropertyValueConverter for property 'socialNetworks' of content type 'Home' because type 'Umbraco.Web.PropertyEditors.ValueConverters.RelatedLinksEditorValueConvertor' has already been detected as a converter for that property, and only one converter can exist for a property.

    This is a part of my code:

    public class RelatedLinks : PropertyValueConverterBase
    {
    
        public override bool IsConverter(PublishedPropertyType propertyType)
        {
            return Constants.PropertyEditors.RelatedLinksAlias.Equals(propertyType.PropertyEditorAlias);
        }
    

    Could any one please help me out?

  • Jeroen Wijdeven 31 posts 72 karma points MVP
    Dec 24, 2013 @ 17:59
    Jeroen Wijdeven
    0

    It seems this problem only occurs for RelatedLinks. So this looks like a bug for me. Other converters for Content, Macro, en Mediapicker work as expected. However, the problem I tried to solve is fixed. Because Umbraco returns a JArray which you can be used like an object in a Razor view. And the (JSON Array) object it returns is a nice object by it self, so I don't need to cast is to my own type of object. For example the next piece works, fine:

    @foreach(var linkItem in @CurrentPage.SocialNetworks) 
    {
       <a href="@linkItem.link">some text</a>
    }
    
  • Jeroen Wijdeven 31 posts 72 karma points MVP
    Jan 10, 2014 @ 15:39
    Jeroen Wijdeven
    0

    Problems again. When the link is internal it only returns an id. I need the friendly url and there for I like to create my own Converter again. Which is not possible because of the error. Hopefully someone could tell me this is fixed in the next release of Umbraco v7.. Anyone?

  • Shannon Deminick 1524 posts 5270 karma points MVP 2x
    Jan 15, 2014 @ 03:52
  • Jeroen Wijdeven 31 posts 72 karma points MVP
    Jan 15, 2014 @ 10:09
    Jeroen Wijdeven
    0

    Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft