I want to e.g. fetch the path /content/branc/region/microsite_name/en/mypage/jcr:content/par/mycomponent
in jQuery.
I am able to fetch the page path using Granite.author.page.
Code to fetch page path:
(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);
Kindly advice how to fetch the component path in jquery.
The resourcetype is available in Granite.author.DialogFrame.currentDialog.editable.type
. The path in the type field is not absolute and lacks the '/apps or /libs' part. If you are interested in the absolute path try Granite.author.DialogFrame.currentDialog.editable.config.dialog