Foros de discusión

Liferay.Service.Portal.getLayoutName in Javascript

Lior Hadaya, modificado hace 11 años.

Liferay.Service.Portal.getLayoutName in Javascript

Regular Member Mensajes: 138 Fecha de incorporación: 24/01/12 Mensajes recientes
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, modificado hace 11 años.

RE: Liferay.Service.Portal.getLayoutName in Javascript

Liferay Legend Mensajes: 3089 Fecha de incorporación: 28/10/08 Mensajes recientes
Did you check what are the needed params for that method? Probably you have to provide a param (for example, current plid).
Lior Hadaya, modificado hace 11 años.

RE: Liferay.Service.Portal.getLayoutName in Javascript

Regular Member Mensajes: 138 Fecha de incorporación: 24/01/12 Mensajes recientes
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.