我想在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中获取组件路径。
答案 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
。