How to access custom page fields in a theme template

I would like to use custom fields to display some strings in a topic.

I created a custom "intro" field of type Textbox.

How do I access the data in the theme template (speed)?

Since there is no "introspection" that variables declare, it is very difficult for me to figure out how to get them. The documentation is far from being used on the topic of custom fields: - /


source to share

3 answers

If you are defining a custom attribute on the page than you can use



Also see the javadoc or source for com.liferay.portlet.expando.model.ExpandoBridge



if you need to use in FTL template, in my case for menu navigation template

<#assign prop = navItem.getLayout (). getExpandoBridge (). getAttribute ("prop_name")>



Work with me at Liferay 7+:

Create a custom field type "site", fill in the data in the site settings and use the theme in the template to call this data into the liferay theme:

If the VM file:

#set ($site_custom_field = $layout.getGroup().getExpandoBridge().getAttribute("site_custom_field_key"))


If the file is FTL:

<#assign site_custom_field = layout.getGroup().getExpandoBridge().getAttribute("site_custom_field_key")>


Have a nice day!



All Articles