3 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.

The package v1.x supports Umbraco 7.7+, and v2.x supports Umbraco 8+.

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:

  • Media Picker
  • 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

Package owner

Callum Whyte

Callum Whyte

Callum has 180 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
8.2.x (untested)
8.1.x (100%)
8.0.x (100%)
7.15.x (untested)
7.14.x (100%)
7.13.x (100%)
7.12.x (100%)
7.11.x (100%)
7.10.x (100%)
7.9.x (100%)
7.8.x (100%)
7.7.x (100%)
7.6.x (untested)
7.5.x (untested)
7.4.x (untested)
7.3.x (untested)
7.2.x (untested)
7.1.x (untested)
7.0.x (untested)
6.1.x (untested)
6.0.x (untested)

You must login before you can report on package compatibility.

Package Information

  • Package owner: Callum Whyte
  • Created: 06/02/2019
  • Current version 2.0.1
  • .net Version 4.5,4.7.2
  • License MIT
  • Downloads: 149

External resources