如何在AEM Touch UI对话框中找到组件路径?

时间:2019-03-07 10:29:48

标签: jquery aem aem-touch-ui

我想在jQuery中获取路径/content/branc/region/microsite_name/en/mypage/jcr:content/par/mycomponent

我能够使用Granite.author.page获取页面路径。

获取页面路径的代码:

(function ($, $document, author) {
    "use strict";   
$(document).on("dialog-ready", function() {
    var path = author.page`enter code here`.path; //This works
    var component = author.component.path; //This is not working
    console.log("component path " +component);
   });
})($, $(document), Granite.author);

请忠告如何在jquery中获取组件路径。

2 个答案:

答案 0 :(得分:1)

资源类型在PyColours中可用。类型字段中的路径不是绝对的,并且缺少“ / apps或/ libs”部分。如果您对绝对路径感兴趣,请尝试Granite.author.DialogFrame.currentDialog.editable.type

答案 1 :(得分:0)

正如@ sharath-madappa所指出的,resourceType可从Granite.author.DialogFrame.currentDialog.editable.type获得。

如果要获得调用对话框的组件的确切路径,可以使用Granite.author.DialogFrame.currentDialog.editable.path

有关它的更多文档:https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/jsdoc/ui-touch/editor-core/Granite.author.DialogFrame.html