Skip to content

Instantly share code, notes, and snippets.

@pedroblandim
Created August 29, 2022 08:04
Show Gist options
  • Save pedroblandim/3f603cd5675b412d1e8accfeac182264 to your computer and use it in GitHub Desktop.
Save pedroblandim/3f603cd5675b412d1e8accfeac182264 to your computer and use it in GitHub Desktop.
LIFERAY: Get localized custom field value on widget template
<#function getLocalizedCustomFieldValue navItem customFieldName>
<#assign customField = navItem.getLayout().getExpandoBridge().getAttribute(customFieldName)>
<#if customField??>
<#list customField?keys as key>
<#if key == locale>
<#return customField?values[key_index]!"" />
</#if>
</#list>
<#else>
<#return "" />
</#if>
</#function>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment