Foren

Liferay.Service.Portal.getLayoutName in Javascript

Lior Hadaya, geändert vor 11 Jahren.

Liferay.Service.Portal.getLayoutName in Javascript

Regular Member Beiträge: 138 Beitrittsdatum: 24.01.12 Neueste Beiträge
Hello,

I'm using Liferay EE 6.1.20 and I'm trying to get the name of the current layout using Javascript.
I tried to use the getLayoutName method but the callback receives null as the result:

var params = {};
var layout;
Liferay.Service.Portal.Layout.getLayoutName(params, function(p) {
	layout = p;
});

I tried to debug the service call and didn't see anything unusual, it seems that Liferay does send a request and gets a response back, just without the name of the layout..

Can you please tell me what I'm doing wrong?

Thanks,

Lior
thumbnail
Juan Gonzalez P, geändert vor 11 Jahren.

RE: Liferay.Service.Portal.getLayoutName in Javascript

Liferay Legend Beiträge: 3089 Beitrittsdatum: 28.10.08 Neueste Beiträge
Did you check what are the needed params for that method? Probably you have to provide a param (for example, current plid).
Lior Hadaya, geändert vor 11 Jahren.

RE: Liferay.Service.Portal.getLayoutName in Javascript

Regular Member Beiträge: 138 Beitrittsdatum: 24.01.12 Neueste Beiträge
I haven't been able to find official documentation for the method (or any of Liferay's Javascript API for that matter).
According to the browser console, the method expects to get two parameters - params object and a callback. I have no idea if I need to set any data inside the params object.