julho 22, 2017
Using Optimizely Blocks, to e.g. support re-usable components, in Optimizely Commerce content is a very common scenario.
Out of the box, that is indeed also possible. It only requires you to register a ContentReference driven property type – e.g. ContentReference, ContentArea or List – for it to be supported in the authoring interface.
After you’ve done that, you will probably realize that the “Blocks” asset panel in the right hand side pane by default is unavailable to your editors, requiring these to manually go in an add the “Blocks” gadget to their view.
How to enable the “Blocks” panel, by default, in Optimizely’s Catalog view
Enabling “Blocks”, by default, in Optimizely’s Catalog is very easy. Since it’s not documented anywhere, it’s absolutely worth writing a simply blog post about!
You’ll only need to create a single class, which through Optimizely’s component system makes the “Blocks” gadget available for both existing and new content editors.
[Component]
public class SharedBlocksNavigationComponent : ComponentDefinitionBase
{
public SharedBlocksNavigationComponent() : base("epi-cms/component/SharedBlocks")
{
this.LanguagePath = "/episerver/cms/components/sharedblocks";
this.SortOrder = 150;
this.PlugInAreas = new string[] { "/episerver/commerce/assets/defaultgroup" };
this.Categories = (IEnumerable<string>)new string[1]
{
"commerce"
};
this.Settings.Add(new Setting("repositoryKey", BlockRepositoryDescriptor.RepositoryKey));
}
}
Original article was posted on Optimizely Fellow:
http://fellow.aagaardrasmussen.dk/2017/07/22/enabling-blocks-by-default-in-episerver-commerce/