November Happy Hour will be moved to Thursday December 5th.

Loading...
Area: Optimizely CMS
ARCHIVED This content is retired and no longer maintained. See the latest version here.

Recommended reading 

Grouping content types and properties

You can group content types and their properties into logical entities. For example, you can create a group called News articles. The GroupName property specifies the group. The Order property determines the order in which content types are displayed. For example, if ArticlePage has the lowest order, the News articles group is displayed first and then other content types in that group according to the order.

[ContentType(GroupName="News articles", Order=1)]
public class ArticlePage : PageData
{
}

Use the Display attribute to specify the group that are displayed as tabs. The Order property controls the order of the displayed properties. For example, if Phone is the first property, then Contact is displayed first and other properties under that tab according to the order.

[ContentType(GroupName="News articles", Order=1)]
public class ArticlePage : PageData
{
   [Display(GroupName = "Contact", Order=1)]
   public virtual string Phone { get; set; }
}

Built-in groups

EPiServer provides the following groups that are used by built-in properties. You can add custom properties into these groups. The constants are defined in EPiServer.DataAbstraction.SystemTabNames.

NameSort IndexDescription
Content 10 Default group used for properties that does not specify a group name. The actual group name is “Information”.
Settings 30 Used for some of more advanced built-in properties. The actual group name is “Advanced”.
PageHeader N/A The page header that is shown above the tabs or by scrolling up in the on page edit view. The actual group name is EPiServerCMS_SettingsPanel.

Sorting groups

Many scenarios can use the default behavior, but when the number of content types and properties increase you can define the order of groups at a higher level, then use order to sort among the content types and properties in each group.

Define the group names in a separate class as constants and decorate the class with with the GroupDefinitions attribute (which is automatically picked up). You can define multiple classes with the GroupDefinitions attribute but you can define a single group name on one class only. Groups defined in code are not editable in the user interface.

Set the order in which groups are displayed with the Display attribute. Properties and content types are sorted within each group by each individual order. Groups that have no order defined get Order=-1 and are displayed first.

[ContentType(GroupName=GroupNames.News)]
public class ArticlePage : PageData
{
    [Display(GroupName = GroupNames.Contact)]
    public virtual string Phone { get; set; }
}

The following example shows how to override built-in groups to change sort order.

[GroupDefinitions]
public static class GroupNames
{
    [Display(Order = 1000)]
    public const string Content = SystemTabNames.Content;
}

Limiting access to group definitions

When you group content types and properties, you can apply access permissions so that an editor must be part of a role, function, or other criteria to use the grouped content type. The following example shows an advanced settings group that is only visible to editors that have Publish rights. Required access level applies to both groups of properties and groups of content types.

[GroupDefinitions]
public static class GroupNames
{
     [Display(Order = 1)]
     [RequiredAccess(AccessLevel.Publish)]
     public const string AdvancedSettings = "AdvancedSettings";
 }

NOTE: You cannot use the administrative interface to edit groups that are defined in code.

Do you find this information helpful? Please log in to provide feedback.

Last updated: Feb 23, 2015

Recommended reading