A common requirement for implementing custom features in Sitefinity CMS is the ability to add functionality to the existing back-end screens for managing content.
Most of the back-end screens implementations are based on the so called "definitions" - a data structure that describes or defines the way that both back-end and front-end controls (screens) should look like and behave. The default definitions values are created in memory as configuration elements and not persisted as XML unless someone modifies them through the configurations advanced screens (the advanced configurations UI) or the API. So most of the time those definitions are actually configurations which makes the UI easily user configurable. However there is another very important aspects of those "definitions" data structures. They were designed in a way that enables developers to create or modify them without having to deal with configurations since this should only be an option if you wish your UI to be configurable. This was achieved by implementing simple in memory containers that can't be persisted as configurations but could be serialized and stored in the database.
The IDefinitionExtender interface provides the ability for runtime modification of existing definitions through code without manipulating configurations..
Here is an example implementation of an extender that adds a new command button inside the more actions widget:
public class MyDefinitionsExtender : IDefinitionsExtender
public void ExtendDefinition(IContentViewControlDefinition contentViewControlDefinition)
// Not a real selection of view, toolbar, section or items
// just a way to show the depth of the definition and
// where could the desired change be made.
var moreActionsWidgetDefinition = contentViewControlDefinition.Views.Toolbar.Sections.Items;
Name = "buttonName",
Text = "click me",
WrapperTagKey = HtmlTextWriterTag.Li,
CommandName = "customCommandName1",
WidgetType = typeof(CommandWidget)
Here is how to register your definition extender so that its ExtendDefinition method will be called each time a widget or control receives its definition data structure:
ObjectFactory.Container.RegisterInstance<IControlDefinitionExtender>("MyExtender", new MyDefinitionsExtender(), new ContainerControlledLifetimeManager());
>("MyExtender", new MyDefinitionsExtender(), new ContainerControlledLifetimeManager());
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important
Copyright © 2019 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.