Copied to clipboard

Flag this post as spam?

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


  • Delete 61 posts 450 karma points
    Jun 16, 2017 @ 09:41
    Delete
    3

    More details about uConfiguration plugin

    • Unique key for accessing values is generated as: [SectionAlias].[GroupAlias].[PropertyAlias] enter image description here

    • All data is stored in App_Data\uConfiguration\ folder in JSON format

    • You can get setting value by key in several ways:

    For simple types (string, int, double, etc):

    ConfigurationHelper.Value<T>(string key)
    or
    ConfigurationHelper.Value<T>(string key, T defaultValue)
    

    These methods are useful for following types: Color Picker, Date, Date/Time, Decimal, Email address, Numeric, Rich Text Editor, Slider, Textarea, Textbox and True/False

    • Other types with more complex structure can be retrieved via converters:

    enter image description here

    Example of converter usage:

    var items = ConfigurationHelper.Value<string[]>([key], new StringToArrayValueConverter(','));
    
    • Plugin provides converters for common Umbraco types and wrappers that can do the same thing with less code. List of types and converters below:

    Data Types: Checkbox list, Dropdown list, Dropdown list multiple, Dropdown list multiple, publish keys, Dropdown list, publishing keys, Radio button list

    Converters:

    string ConfigurationHelper.Value<string>(string key, new PreValueAsStringValueConverter())

    <IEnumerable<string>> ConfigurationHelper.Value<IEnumerable<string>>(string key, new PreValuesAsStringValueConverter())

    Wrappers:

    string ConfigurationHelper.PreValueAsString(string key)

    IEnumerable<string> ConfigurationHelper.PreValuesAsString(string key)


    Data Type: Content Picker

    Converter:

    IPublishedContent ConfigurationHelper.Value<IPublishedContent>(string key, new ContentValueConverter());

    Wrapper:

    IPublishedContent ConfigurationHelper.Content(string key)


    Data Type: Markdown editor

    Converter:

    string ConfigurationHelper.Value<string>(string key, new MarkdownValueConverter());

    Wrapper:

    string ConfigurationHelper.Markdown(string key)


    Data Type: Media Picker

    Converters:

    string ConfigurationHelper.Value<string>(string key, new MediaPickerAsStringValueConverter());

    IEnumerable<string> ConfigurationHelper.Value<IEnumerable<string>>(string key, new MediaPickersAsStringValueConverter());

    IPublishedContent ConfigurationHelper.Value<IPublishedContent>(string key, new MediaPickerValueConverter());

    IEnumerable<IPublishedContent> ConfigurationHelper.Value<IEnumerable<IPublishedContent>>(string key, new MediaPickersValueConverter());

    Wrappers:

    string ConfigurationHelper.MediaUrl(string key)

    IEnumerable<string> ConfigurationHelper.MediaUrls(string key)

    IPublishedContent ConfigurationHelper.Media(string key)

    IEnumerable<IPublishedContent> ConfigurationHelper.MediaItems(string key)


    Data Type: Member Picker

    Converter:

    IMember ConfigurationHelper.Value<IMember>(strig key, new MemberValueConverter());

    Wrapper:

    IMember ConfigurationHelper.Member(string key)


    Data Type: User picker

    Converter:

    IUser ConfigurationHelper.Value<IUser>(string key, new UserValueConverter());

    Wrapper:

    IUser ConfigurationHelper.User(string key)


    Data type: Related links

    Converter:

    IEnumerable<RelatedLink> ConfigurationHelper.Value<IEnumerable<RelatedLink>>(string key, new RelatedLinksValueConverter());

    Wrapper:

    IEnumerable<RelatedLink> ConfigurationHelper.RelatedLinks(string key)


    Data types: Tags

    Converter:

    string[] ConfigurationHelper.Value<string[]>(string key, new StringToArrayValueConverter(separator))

    Wrapper:

    string[] ConfigurationHelper.StringToArray(string key, char separator)


    Data types: Repeatable textstrings

    Converter:

    IEnumerable<string> ConfigurationHelper.Value<IEnumerable<string>>(string key, new RepeatableTextstringValueConverter())

    Best regards,

    Vitaly

Please Sign in or register to post replies

Write your reply to:

Draft