2

I need to access the theme_display in a Liferay 7.3 Web Content Template.

I tried the following code (from Liferay Portal 6.2 - How to get theme_display in Web Content Template) but it doesn't work (change in Liferay 7.x) I would guess.

<#assign
serviceContextThreadLocal = staticUtil["com.liferay.portal.kernel.service.ServiceContextThreadLocal"]
themeDisplay = serviceContextThreadLocal.getServiceContext().getThemeDisplay()
/>

My goal is to access the login URL dynamically. I have the following code in my theme which works, but I now need it for some specific content.

theme_display.getURLSignIn()

1 Answers1

3

It should work with just ${themeDisplay.getURLSignIn()}. I used it with a dip 7.3 Also the following gist might be helpful: https://gist.github.com/bmvakili/2e83d1b73964d14d873ba5486bc28dd5

Andre Albert
  • 1,386
  • 8
  • 17
  • Worked perfectly. I feel pretty dumb. That should have been easy to figure out. And the Gist is very much appreciated. I was able to replace some old code I had gotten from somewhere to dump variables. That code stopped working for a lot of the values. So extra kudos for that! – Scott McIntosh Jan 27 '22 at 16:22