Copied to clipboard

Flag this post as spam?

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


  • Bas-kolthof-triple 1 post 21 karma points
    Oct 30, 2023 @ 16:14
    Bas-kolthof-triple
    0

    Is this a valid use case for property value converters?

    I'm currently working on a application that will use the content delivery API. However, a lot of the data provided is not quite in the form we'd like it.

    Would using the IPropertyValueConverter/IDeliveryApiPropertyValueConverter interfaces to morph content on specific properties or DataTypes (as in, a specific editor config) be a valid use case or a horrible unsupported hack?

    Example of what I mean:

            public bool IsConverter(IPublishedPropertyType propertyType)
        {
            //Or some other way of finding the specific data type.
            var typeId = _dataTypeService
                .GetAll()
                .FirstOrDefault(x => x.Name == "Article - Multinode Treepicker - Related")?.Id;
    
            if (propertyType.DataType.Id == typeId )
            {
                return true;
            }
    
            return false;
        }
    

    I know it works, but is it kosher?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies