Hi All
We are unable to get the custom field related to the NavItem in the fragment, we have performed below steps -
- Create a text custom field for SiteNavigationMenuItem through control panel as “promotion”
- Create a Menu Item and added value of “promotion” as true
- Create a fragment with source type navigationMenuSelector to render the content
- drop it on the page and select the menu items we created with custom field
- in fragment iterate through sourceObject.navItems and print expando attributes of the navItem
- Observe that its not printing"promotion", while one of the navitem has value in custom field.
- Its printing the custom fields size of the type of menu item like layout.
- The navItem are of type com.liferay.portal.kernel.theme.navItem, however the custom fields are created for SiteMenuNavigationItem.
How can we get the custom field value for actual the navItem?
HTML -
[#assign entries = sourceObject.navItems]
[#list entries as navItem]
[#assign customFields = navItem.getExpandoAttributes()]
<br><b>${navItem.getName()}</b><br>
<i>
[#list customFields as customFieldKey, customFieldValue]
key - ${customFieldKey}
[/#list]
<i>
[/#list]
Configuration -
{
"fieldSets": [
{
"fields": [
{
"label": "source",
"name": "source",
"localizable": true,
"type": "navigationMenuSelector"
}
]
}
]
}
Thanks