Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

HomeDev GuideRecipesAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Inline edit blocks

Describes inline edit blocks that simplify editing for common properties.

The inline edit dialog box is designed to be simple yet allow editors to edit a block's most common properties.

Optimizely Content Management System (CMS) introduced the InlineBlockEditSettings configuration attribute to apply to your block content type and hide or show the Name and Categories properties. You can also use this attribute to hide specific groups to make the editing form cleaner.

The attribute contains three properties:

  • ShowNameProperty – When true, then Name property is displayed. The default is false.
  • ShowCategoryProperty – When true, then Categories property is displayed. The default is false.
  • HiddenGroups – Comma-separated list of tabs to hide. The default is Advanced.

📘

Note

Advanced group is the Settings tab in the user interface, which is hidden by default in the inline edit dialog box.

Change settings for a specific block content type

To turn on the Name property for a specific block content type:

[SiteContentType(GUID = "67F617A4-2175-4360-975E-75EDF2B924A7",
  GroupName = SystemTabNames.Content)]
[SiteImageUrl]
[InlineBlockEditSettings(ShowNameProperty = true)]
public class EditorialBlock: SiteBlockData {
  [Display(GroupName = SystemTabNames.Content)]
  [CultureSpecific]
  public virtual XhtmlString MainBody {
    get;
    set;
  }
}

To display Name and Categories properties and Settings group:

[SiteContentType(GUID = "9E7F6DF5-A963-40C4-8683-211C4FA48AE1")]
[SiteImageUrl]
[InlineBlockEditSettings(ShowNameProperty = true, ShowCategoryProperty = true, HiddenGroups = "")]
public class AdvancedBlock: SiteBlockData {
  [Display(Order = 1, GroupName = SystemTabNames.Content)]
  public virtual string Text1 {
    get;
    set;
  }

  [Display(Order = 2, GroupName = SystemTabNames.Content)]
  public virtual string Text2 {
    get;
    set;
  }

  [Display(Order = 1, GroupName = Global.GroupNames.Products)]
  public virtual string Text3 {
    get;
    set;
  }

  [Display(Order = 2, GroupName = Global.GroupNames.Products)]
  public virtual string Text4 {
    get;
    set;
  }
}

To hide more than one group:

[SiteContentType(GUID = "9E7F6DF5-A963-40C4-8683-211C4FA48AE1")]
[SiteImageUrl]
[InlineBlockEditSettings(HiddenGroups = "Advanced, Contact")]
public class AdvancedBlock: SiteBlockData {
  [Display(Order = 1, GroupName = SystemTabNames.Content)]
  public virtual string Text1 {
    get;
    set;
  }

  [Display(Order = 2, GroupName = SystemTabNames.Content)]
  public virtual string Text2 {
    get;
    set;
  }

  [Display(Order = 1, GroupName = Global.GroupNames.Products)]
  public virtual string Text3 {
    get;
    set;
  }

  [Display(Order = 2, GroupName = Global.GroupNames.Contact)]
  public virtual string Text4 {
    get;
    set;
  }
}

Change settings for multiple block content types

If you want to show Name for several block content types, you can configure the setting in their base class like this:

[InlineBlockEditSettings(ShowNameProperty = true)]
public abstract class SiteBlockData: EPiServer.Core.BlockData {}

[SiteContentType(GUID = "9E7F6DF5-A963-40C4-8683-211C4FA48AE1")]
[SiteImageUrl]
public class AdvancedBlock: SiteBlockData {
  [Display(Order = 1, GroupName = SystemTabNames.Content)]
  public virtual string Text1 {
    get;
    set;
  }

  [Display(Order = 2, GroupName = SystemTabNames.Content)]
  public virtual string Text2 {
    get;
    set;
  }

  [Display(Order = 1, GroupName = Global.GroupNames.Products)]
  public virtual string Text3 {
    get;
    set;
  }

  [Display(Order = 2, GroupName = Global.GroupNames.Contact)]
  public virtual string Text4 {
    get;
    set;
  }
}

📘

Note

If you want to change a setting in a child block type, while still wanting to have some other settings from the base class, you have to copy those settings to the child block type class because the settings in the child block type override the settings in the base class.

Override auto-generated name for inline-creating blocks

Because the Name property is hidden by default, blocks created from an inline edit dialog (inline create) get an automatically generated name using ILocalAssetNameGenerator, and the default format is PageName BlockType AutoIncrementId.

To override the default auto-generated name format, implement ILocalAssetNameGenerator.