embedportletliferay-7liferay-theme

Liferay DXP: Embed Liferay form in theme


I was trying to find the way to add form to the footer in my liferay theme and did not find anything related. Then found a solution and thought it may benefit others.


Solution

  • Here is the solution:

    Create your form: Login to your site and go to Control Panel -> Content and data -> Forms -> Create your form

    Add code to display the form Portlet in your Theme/Header/Footer : In your portal_normal.ftl or other corresponding file where you want to add the form, place the following code:

    <@liferay_portlet["runtime"]              
        portletName="com_liferay_dynamic_data_mapping_form_web_portlet_DDMFormPortlet"    
        defaultPreferences="${freeMarkerPortletPreferences}"
    />
    

    and deploy your theme.

    On your page you will see the the form portlet is there now.

    Select your form using the form portlet's UI.

    Navigate to other pages to confirm that your form shows at every page.