I succeeded to create an custom module with a page where the editor can change settings. What did I exactly do:
- Created a custom module (docs.kentico.com/display/K82/Creating+custom+modules)
- Created some custom settings (docs.kentico.com/display/K82/Adding+custom+website+settings)
- Created a interface (docs.kentico.com/display/K82/Manually+creating+the+interface+for+custom+modules)
- The code of the webform is:
ASPX:
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/CMSMasterPages/UI/SimplePage.master"
CodeBehind="SiteSettings.aspx.cs" Theme="Default" Inherits="SiteSettings" %>
<%@ Register TagPrefix="cms" TagName="SettingsGroupViewer" Src="~/CMSModules/Settings/Controls/SettingsGroupViewer.ascx" %>
<asp:content contentplaceholderid="plcContent" id="content" runat="server">
<cms:SettingsGroupViewer ID="SettingsGroupViewer" runat="server" AllowGlobalInfoMessage="false" />
</asp:content>
ASPX.cs
using CMS.Base;
using CMS.ExtendedControls.ActionsConfig;
using CMS.SiteProvider;
using CMS.UIControls;
using System;
using System.Web.UI.WebControls;
public partial class SiteSettings : CMSModalPage
{
#region "Page events"
protected void Page_Load(object sender, EventArgs e)
{
// Set up header
CurrentMaster.HeaderActions.AddAction(new SaveAction(this));
CurrentMaster.HeaderActions.ActionPerformed += HeaderActions_ActionPerformed;
// Assign category, group and site ID
SettingsGroupViewer.CategoryName = "BDO.CustomSettings";
SettingsGroupViewer.SiteID = SiteContext.CurrentSiteID;
}
#endregion
#region "Event Handlers"
/// <summary>
/// Handles actions performed on the master header.
/// </summary>
/// <param name="sender">Sender object.</param>
/// <param name="e">Event argument</param>
protected void HeaderActions_ActionPerformed(object sender, CommandEventArgs e)
{
switch (e.CommandName.ToLowerCSafe())
{
case "save":
SettingsGroupViewer.SaveChanges();
break;
}
}
#endregion
}