Customizing Social Office 3.0 using plugins
General Blogs February 17, 2014 By Jamie L Sammons
In the Liferay Developers Guide there is a nice little tidbit titled "Creating Plugins to Extend Plugins" found here. This basically allows a lot of the same principles used with hook plugins when customizing Liferay. The difference here is that it allows you to customize portlet plugins with plugins. As with hook plugins this allows a degree of separation between your customization's and the default application.
This same concept can also be used to customize Social Office plugins (including Social Office EE plugins). The name of the new plugin must match the name of the original plugin since the so-hook expects the original name.
We had a need to hide the two public Site types in Social Office (Open and Public Restricted) since we share our Portal instance with our Clients.
Do the following to customize the so-portlet:
- In Liferay IDE create a new Liferay Portlet Plugin project called: so-portlet
- Expand the new so-portlet project and delete everything below docroot
- Copy the original so-portlet WAR file into the root directory of the new so-portlet project in eclipse:
- Edit the build.xml ANT script and add the following property to the script:
<property name="original.war.file" value="so-portlet-22.214.171.124-ce-ga1-20140210151141114.war" />
- Run the all Ant task. A new tmp directory will show up at the root of the so-portlet project (may need to refresh). At this point this is the contents of the original war file.
- Copy tmp/WEB-INF/liferay-plugin-package.properties to docroot/WEB-INF in the so-portlet project (Create WEB-INF if it doesn't already exist).
- Modify liferay-plugin-package.properties and change module-incremental-version to 10. This will cause your custom so-portlet to always take priority over the default so-portlet.
- Copy tmp/sites/edit_site.jsp to docroot/sites
- Modify docroot/sites/edit_site.jsp and remove the lines that define Public and Public Restricted Sites (Search for TYPE_SITE_OPEN and TYPE_SITE_PUBLIC_RESTRICTED).
- Run the all Ant task again and now tmp will be a combination of the default war file and your cusomizations. This also generates a custom war file in the plugins SDK dist folder that can be deployed to a Liferay server
That's pretty much it. This procedure can be used with pretty much any portlet project including EE versions.