4 votes

Key Value Editor

The Key Value Editor package allows editors to create key value pair lists within instances of their document types. The editor can add, edit and delete pairs. The current version of this package is only compatible with version 7 of Umbraco.

If you'd like to contribute to the package, please visit https://bitbucket.org/rbdigital/umbraco-keyvalue-editor, fork the repository and send a pull request.

Set Up

Create a new data type using the RB.KeyValueEditor property editor. Add a new property to a document type using the new data type you have just created. Once you have created your new property, you should be able to add a list of key value pairs on any instances of your document type where the new data type exists.

Converter

When using a property value on a template, add the following code to create a strongly type version of the key value editor property value.

@{
    Dictionary<string, string> keyValuePairs = CurrentPage.GetPropertyValue<Dictionary<string, string>>("alias");
}

Once converted, you will be able to choose single items and loop through each. For example:

@{
    // Find a single key value pair based on key
    var single = keyValuePairs.SingleOrDefault(k => k.Key.Equals("local"));
    
    // Loop through each pair
    foreach (var pair in keyValuePairs)
    {
        @pair.Key;
        @pair.Value;
    }
}

Screenshots

Package owner

RB

RB

RB has 150 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 (untested)
8.0.x (untested)
7.15.x (untested)
7.14.x (untested)
7.13.x (untested)
7.12.x (untested)
7.11.x (untested)
7.10.x (untested)
7.9.x (untested)
7.8.x (untested)
7.7.x (untested)
7.6.x (untested)
7.5.x (100%)
7.4.x (untested)
7.3.x (100%)
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: RB
  • Contributors: Dan Lister
  • Created: 24/06/2014
  • Current version 1.0.0
  • License MIT
  • Downloads: 2074