Type: Regression Bug
Affects Version/s: 7.0.X EE, Master
Web content templates do not have access to a ThemeDisplay, but as a result of changes we made in Master, code in Liferay requires a ThemeDisplay (in order to retrieve the associated request) before tag library support is injected. While there is a ThemeDisplay available in the ServiceContext, this is also not accessible from the template.
One approach you might consider is to make it so that anything that doesn't take in a ThemeDisplay uses a default one, but unfortunately, none of those methods are available from a web content template, because a null value must be passed for PortletRequestModel, but that results in web content templates being unable to identify which method to call because every method has an equivalent that takes in a ThemeDisplay instead of a PortletRequestModel, and Freemarker is unable to infer the correct type.
Therefore, in addition to doing the above in order to improve consistency, we will need to add new API that is unambiguous and allows you to pass in neither a PortletRequestModel nor a ThemeDisplay.
Steps to Reproduce
- Login as Test Test
- Open the side menu, and go to Control Panel > Configuration > System Settings
- Select "Web Content Administration", uncheck "Journal article force autogenerate id", and save
- Open the side menu, and go to Liferay DXP > Content > Web Content
- Click on the "..." on the top right and select Templates
- Add a new Freemarker template, associated with the structure "Basic Web Content", with the title EMBED_INNER and the following script:
- Add a new Freemarker template, associated with the structure "Basic Web Content", with the title EMBED_OUTER and the following script:
- Click on the "<" arrow on the top of the page to navigate back to the Web Content section
- Add a new Basic Web Content select the EMBED_INNER template, give it the Title and ID EMBED_INNER
- Add a new Basic Web Content, select the EMBED_OUTER template, give it the Title and ID EMBED_OUTER
- Select the "Preview" button for the EMBED_OUTER article
Steps to Test Fix
The fix adds new API, and it can be tested by changing the EMBED_OUTER template to the following script: