Friday, 10 November 2017

Theme Velocity Variables and accessing velocity variables

Liferay provides us easy way to access liferay methods in theme level.


How to access?

Using Velocity Variables.

What are the available velocity variables?

VelocityVariables.java

Ex:
If we want to check custom permissions assigned for our custom portlet.

We need to check the permission using PortletPermissionUtil.

In portlet .jsp pages we will be using PortletPermissionUtil.

<c:if test='<%=PortletPermissionUtil.contains(permissionChecker,plid.longValue(),"manageusers_WAR_BrandCentreportlet",ActionKeys.ADD_USER)%>'>
testing
</c:if>

Same thing needs to be done in theme level then we need to use portletPermission instead of  PortletPermissionUtil

In .vm file

#if($portletPermission.contains($permissionChecker, $themeDisplay.getPlid(), "manageusers_WAR_BrandCentreportlet","ADD_USER"))
#set ($vendor-menu = true)
#end

In the same way we can check for available velocity variables here.

TEST

I am Java Developer. I have 6 year Experiance in this field and like to post in blogging. So keep sharing and like my post

0 comments:

Post a Comment

 

Copyright @ 2017 Liferay Article.