The other day I was trying to figure out a good way to manage footer navigation in liferay through manage pages.
I wanted the theme to create a custom field of boolean type that could be set on a page. The benifit of the theme creating the custom field is that then the theme will know the name of the field to look for inorder to filter the navigation.
Here is what the navigation looks like. Footer Group 1 and Footer Group 2 have the Custom Field of “Footer Navigation” set to true.
Here is what the theme looks like.
Here is the code: I create a variable called customFieldName so I can use that through my other vm files. I use the ExpandoBridge from the $layout class so the custom field will be added to the Page type in the custom fields. It checks to see if the custom field exsists, if not then it creates it.
Here are some velocity variables you can use to check permission in the theme such as “portal_normal.vm”
- Returns true if the user is a universal administrator.
- Returns true if the user is an administrator of their company.
- Returns true if the user is an administrator of the company.
This code logs you out and then reloads the current community instead of sending you to the guest community.
If the article ids differ from dev and the prod server this method will grab the articleid from the article title
Add “journal.template.velocity.restricted.variables=” to your portal-ext.properties file to extend