Opt-out from Inline Blocks support in ContentArea properties
WARNING: This post is no longer up to date because from CMS UI 12.23.3 inline blocks are no longer enabled by default.
They have to be turned on manually, more details here: https://world.optimizely.com/blogs/bartosz-sekula/dates/2023/5/inline-blocks-in-contentarea/
Or in the documentation https://docs.developers.optimizely.com/content-management-system/docs/inline-edit-settings
OLD BLOG POST BELOW:
In CMS 12.21.0 we added a way to create inline blocks inside each ContentArea property.
This feature is very powerful and has many advantaged as described in my previous blog post: https://world.optimizely.com/blogs/bartosz-sekula/dates/2023/5/inline-blocks-in-contentarea/
However, this also introduced issues for some clients, mostly non-MVC clients who rely on our API endpoints and always expected that each ContentAreaItem to have a non-null ContentLink.
For such cases in CMS UI 12.22.2 we added a way to opt-out from the ability to create inline blocks inside ContentArea.
This new setting is global and the default value is true
InlineBlocksInContentAreaEnabled is a new boolean property added to UIOptions class. You can set it directly in code or you can also use the appsettings approach as shown below:
"EPiServer": {
"CmsUI": {
"UI": {
"InlineBlocksInContentAreaEnabled": false
}
}
}
After turning that flag to false the link to create an inline block in each ContentArea property will no longer be available.
Of course it is still possible to use the Assets pane to create shared blocks within the folder structure or use the `For this page/block` folder as contextual storage.
Important note: It is no longer possible to create shared blocks from Content Area.
12.22.2 also introduces a way to configure the labels for inline blocks.
By default inline blocks labels are just their type names. It is fine if there are just a few but if the list of blocks is long it may be very problematic to find the block you need to edit (because in contrast to the On-Page-Edit here you don't see the view of the block). We added a way to instruct ContentArea to use a specific property from block type as a label.
In order to do it you can use the new InlineBlockNamePropertiesOptions which can be set via appsettings.json in the following way:
"EPiServer": {
"CmsUI": {
"InlineBlockNameProperties": {
"Contact": "Heading",
"Teaser": "Heading"
}
}
}
It is a simple Dictionary<string, string> of BlockTypeName / PropertyName
Of course both options classes can be set in c#:
services.Configure<UIOptions>(o => {
o.InlineBlocksInContentAreaEnabled = false;
});
services.Configure<InlineBlockNamePropertiesOptions>(options =>
{
options.Add("Teaser", "Heading");
});
More details available here: https://docs.developers.optimizely.com/content-management-system/docs/inline-edit-settings
Comments