在GUI扩展中访问"自定义配置"

Raú*_*ero 10 tridion tridion-2011

我正在通过覆盖其中一个javascript文件的行为来进行用户界面的GUI扩展(SiteEdit),以添加一些功能.javascript文件是"/Scripts/Components/ExtComponentField.js",目标是" SiteEdit "扩展:

Tridion.Web.UI.Editors.SiteEdit.Views.Content

一切都适用于扩展,我有我想要的,但现在我正在尝试使用

设置/ customconfiguration/clientconfiguration

扩展配置的节点,使用一些初始化参数,但是没有办法在javascript中访问$ config元素,而Tridion.Core.Configuration.Editors ["myExt"].配置为null.

我已经看到在各种javascripts中使用这种自定义配置,如"Dashboard"或"Footprints",但它是否可以在"内容"上使用它?我在扩展配置上遗漏了什么吗?

joh*_*ter 3

恐怕我没有测试过这个,但你应该能够使用:

Extensions.YourExt.getConfigurationItem = function (itemName, editorName)
{
    var editor = $config.Editors[editorName].configuration;
    if (editor)
    {
        var confXml = $xml.getNewXmlDocument(editor);
        var confObj = $xml.toJson(confXml);

        if (confObj[itemName])
            return confObj[itemName];
        else
            return "";
    }
}
Run Code Online (Sandbox Code Playgroud)

然后您可以通过以下方式使用它:

$this.getConfigurationItem("YOUR_CONFIG_ITEM_NAME", "YOUR_EDITOR_NAME").toString();
Run Code Online (Sandbox Code Playgroud)

在您的扩展配置(<theme>节点下方)中,您可以输入自己的配置值:

<customconfiguration>
  <clientconfiguration xmlns="http://www.sdltridion.com/2009/GUI/Configuration/Merge">
  <YOUR_CONFIG_ITEM_NAME>The value</YOUR_CONFIG_ITEM_NAME>
Run Code Online (Sandbox Code Playgroud)

你可否确认 :)