Trupti
Trupti

Reputation: 23

How to find the component path in AEM Touch UI Dialog?

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.

Upvotes: 2

Views: 2017

Answers (2)

jordivilagut
jordivilagut

Reputation: 343

As @sharath-madappa points out, the resourceType is available from Granite.author.DialogFrame.currentDialog.editable.type.

If you want the exact path to the component that invoked the dialog, you can use Granite.author.DialogFrame.currentDialog.editable.path.

More documentation about it: https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/jsdoc/ui-touch/editor-core/Granite.author.DialogFrame.html

Upvotes: 1

Sharath Madappa
Sharath Madappa

Reputation: 3402

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

Upvotes: 1

Related Questions