4 votes

SuperValueConverters

SuperValueConverters is a collection of powerful property value converters for Umbraco, eliminating the need for casting and null checks on Umbraco picker values in views or controllers and helping to keep code cleaner.

v1.x supports Umbraco 7.7+, v2.x supports Umbraco 8, v3.x supports Umbraco 9, and v4.x supports Umbraco versions 10 and beyond.

Usage

Once installed you don't need to do anything to activate SuperValueConverters.

Where a picker that returns multiple items (such as MNTP or Nested Content) has been configured to only allow a single item to be selected (via it's "maxItems" setting), the returned value will now be a single IPublishedContent rather than IEnumerable<IPublishedContent>.

Supported value converters will no longer return null if no value has been picked - an empty collection will be returned instead, preventing the need for null checks.

Currently the following datatypes are supported:

  • Multi-Node Tree Picker
  • Nested Content


Models Builder

SuperValueConverters works seamlessly with Models Builder (if you're using it) to return the correct model types from pickers rather than IPublishedContent.

Where a picker has been configured to only allow items of a specific doctype, the returned value will be already cast to the relevant Models Builder generated model.

In cases where an allowed doctype uses compositions Models Builder will generate an interface for that model. If more than one allowed doctype on a given picker implements the same interface, the returned value will be cast to the shared interface rather than the default IPublishedContent.

Screenshots

Archived files

Documentation

Source code

 Download package
version 2.2.1

NuGet install instructions for Umbraco 7.7.0-9+

Install-Package Our.Umbraco.SuperValueConverters

NuGet install instructions for Umbraco 9+

dotnet add package Our.Umbraco.SuperValueConverters

Package owner

Callum Whyte

Callum Whyte

Callum has 290 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
Version 8.18.x (100%)

You must login before you can report on package compatibility.

Previously reported to work on versions: 8.17.x, 8.16.x, 8.15.x, 8.14.x, 8.13.x, 8.12.x, 8.11.x, 8.10.x, 8.9.x, 8.8.x, 8.7.x, 8.6.x, 8.5.x, 8.4.x, 8.3.x, 8.2.x, 8.1.x, 8.0.x, 7.15.x, 7.14.x, 7.13.x, 7.12.x, 7.11.x, 7.10.x, 7.9.x, 7.8.x, 7.7.x

Package Information

  • Package owner: Callum Whyte
  • Created: 06/02/2019
  • Current version 2.2.1
  • .NET version 4.5,4.7.2
  • License MIT
  • Downloads on Our: 1.2K
  • Downloads on NuGet: 30.9K
  • Total downloads : 32.1K

External resources