How to configure a GUI extension

I would like to make my data expander custom through a configuration file. I found that there is a node 'customconfiguration' in the editor configuration file. I assume that this can be used to customize the behavior of the extension. Is there a way to access this custom node configuration from C #?

+4
source share
2 answers

I do not know that it is used for a data expander, but I am reading the user configuration from the model configuration using the following code:

using System.Xml; using Tridion.Web.UI; using Tridion.Web.UI.Core; namespace Custom.Model { public class Configuration { public static string GetConfigString(string configItem) { XmlDocument customConfiguration = ConfigurationManager.Models["Custom.Model"].CustomXml; XmlNamespaceManager ns = new XmlNamespaceManager(new NameTable()); ns.AddNamespace("c", Constants.EDITOR_CONFIG_NAMESPACE); XmlNode node = customConfiguration.SelectSingleNode("//c:customconfiguration/c:clientconfiguration/c:" + configItem, ns); string configValue = node != null ? node.InnerText : ""; return configValue; } } } 

Instead of using ConfigurationManager.Models, you can use ConfigurationManager.Editors to go to the configuration of your editor. You refer to a model or editor by the name specified in System.config, where you enable the extension, for example. CME as defined in the example below.

 <editor name="CME"> <installpath>C:\Program Files (x86)\Tridion\web\WebUI\Editors\CME\</installpath> <configuration>Configuration\CME.config</configuration> <vdir>CME</vdir> </editor> 
+4
source

The configuration file in the WebRoot / Configuration folder is a common configuration file for the CME application, the "Core" configuration file. In addition, there are configuration files for each editor and model in the CME application. These configuration files have a "custom configuration" available from the ConfigurationManager.

When you create your DataExtenderr, you will need to create a new extension model. And the configuration file for this model, where you can fill out the configuration settings section with the necessary information.

+2
source

Source: https://habr.com/ru/post/1439130/


All Articles