If you need custom functionality or content adjustments that you cannot configure through the properties available from the admin UI, you can develop a page extender for the corresponding page.
Page extenders allow you to modify the back-end definition of existing UI pages without directly editing their source code. You can use them to add new commands or change the initial configuration of pages. For example, you can add additional columns to an object listing (e.g., to display additional properties of registered users) or specify new actions (e.g., perform a specific operation with selected objects).
The following diagram illustrates the function of page extenders.
All page extenders must inherit from the PageExtender<TPage> base class. Substitute the generic parameter with the type of the page you wish to extend.
To find the implementing type of default or other third-party pages that don't make their source code available, the admin UI provides the UI tree view available in the System application. See Register new pages under existing admin UI pages for more information.
using Kentico.Xperience.Admin.Base;
using Kentico.Xperience.Admin.Base.UIPages;
// Extends the user listing from the 'Users' application
public class UserListExtender : PageExtender<UserList>
{
}Within page extenders, you can modify the default configuration of the page and its client template properties.
The extended page is available via the Page property of the extender. Use it to access the properties of the given UI page, such as PageConfiguration for pages based on system templates.
The options available to you largely depend on the type of page you wish to extend. See Reference - UI page templates for a list of templates on which most of the administration interface is built.
using System.Threading.Tasks;
using Kentico.Xperience.Admin.Base;
using Kentico.Xperience.Admin.Base.UIPages;
public class UserListExtender : PageExtender<UserList>
{
// Configures the listing template on which UserList is based
// The available configuration options vary based on the type of the extended page
public override Task ConfigurePage()
{
// Adds a new action to each item in the listing
Page.PageConfiguration.TableActions.AddCommand...
// Adds a new action for the entire listing
Page.PageConfiguration.HeaderActions.AddCommand...
return base.ConfigurePage();
}
// Configures the properties of the client template this page is based on
// Called after the 'ConfigurePage' method
public override Task<TemplateClientProperties> ConfigureTemplateProperties(TemplateClientProperties properties)
{
// Manipulate properties as desired
return base.ConfigureTemplateProperties(properties);
}
}You can use extenders to add new page commands.
Declare a new method within the page extender class and annotate it with the PageCommand attribute. The process is identical to writing commands for UI pages.
[PageCommand]
public async Task<ICommandResponse> MyExtenderCommand()
{
// Command logic...
return Response().AddSuccessMessage("Command executed.");
}Page extenders need to be registered in the system via the PageExtender assembly attribute.
When registering extenders, you need to provide the System.Type of the implementing class.
using Kentico.Xperience.Admin.Base;
// Registers the page extender of the 'MyPageExtender' type into the system
[assembly: PageExtender(typeof(MyPageExtender))]
public class MyPageExtender : PageExtender<MyPage>
{
...
}