Content model properties show up in the Redakt back-office user interface as input fields for content managers. Every property has an associated property editor, which determines how the property input looks and behaves in the back office. The property editors are responsible for reading and writing values to content items.

Configuration

For many properties, you will not have to do any configuration at all. By convention, Redakt selects the property editor that is most suitable for the property type. For example, a string type will result in a single line text property editor.

However, if you wish to change the behavior of a property editor or use a different property editor altogether, you can do so by decorating the property with the appropriate attributes. For example, for a string property type, you could configure a multiline text input, or use a rich text editor instead. See the lists below for more details on the standard property editors and attributes, and how to configure them. The example below shows a few different property configurations.

public class SomeContent: IContentType
{
    // Default single line text input.
    public string Title { get; set; }

    // Required multiline plain text input (textarea) with max length of 200 characters.
    [Required]
    [Multiline]
    [MaxLength(200)]
    public string Intro { get; set; }

    // Selects rich text editor, also default editor for HtmlString.
    [RichTextEditor]
    public string Body { get; set; }

    // Number editor; value not required.
    public int? Count { get; set; }

    // Number editor with 2 decimals and min/max value; value is required because the type is not nullable.
    [NumberEditor(Decimals = 2, Minimum = 0, Maximum = 10000)]
    public decimal Price { get; set; }

    // Select list with constant options and placeholder text.
    [SelectList("black:Black Tea", "green:Green Tea", "rooibos:Rooibos", "chai:Chai")]
    [Placeholder("Select some tea")]
    public string FavouriteTea { get; set; }
}

Standard Property Editors

Redakt CMS comes with a large number of built-in property editors that should meet the needs of most websites. See the individual guides for editor features and how to configure them.

Property Editor Attributes

This is a list of all attributes that can be used to change property editor behavior and validation. The property editor guides discuss these attributes, but they are listed here as well for convenience. Most attributes can only be applied to a limited number of property editors. Some attributes are specific to a single property editor.

These attributes only apply when editing content with the back office application (user-interactive input). Specifically, validation attributes do not have any effect when changing content through back-end code.

Behavior attributes

These attributes change the behavior and display of the editor in the back office.

Validation attributes

These attributes set validation rules against which property value input is validated.

(*) These are not Redakt attributes but standard .NET attributes from the System.ComponentModel.DataAnnotations namespace. All other attributes are part of the Redakt.ContentManagement.Annotations namespace.

Custom Property Editors

If you need a different property editor from any of the standard ones, you can create your own property editor. This involves creating a user interface for the editor in Blazor, and a small .NET class for editor definitions and settings.

You can find an example of a custom property editor (OpenStreetMap location picker) as part of the Redakt Hotel & Resort Demo project on GitHub.