liferayliferay-7liferay-themeliferay-dxp

How to get Create Account Link in Liferay 7 or DXP form themeDisplay


In Liferay 6 it was possible to get various types of links, for example you could get CreateAccount link from themeDiplay by using themeDisplay.getURLCreateAccount().toString(). Check this link

Recently I've migrated to Liferay 7. In my custom theme when I am working with .ftl files I'd like to have create account link but I can't find any suitable methods for it. Although you can find getURLSignIn() and getURLSignOut. Check this link

Is there any chance to find a create account url by themeDisplay? If not what should I do?


Solution

  • For theme freemaker template, you can use following.

    <#assign plid = layout.getPlid()>
    <#assign createAccountURL = portletURLFactory.create(request,"com_liferay_login_web_portlet_LoginPortlet",plid,"RENDER_PHASE")>
    ${createAccountURL.setParameter("mvcRenderCommandName", "/login/create_account")}
    ${createAccountURL.setParameter("p_p_state", "maximized")}
    ${createAccountURL.setParameter("p_p_mode", "view")}
    
    <a href="${createAccountURL}"> Create Account </a>