Liferay Hooks are the best plugin for customizing Liferay’s core features. If possible, use hooks whenever you need to override Liferay’s core functionality. It’s possible to use Ext plugins for many of the same tasks, but hooks are hot-deployable and more forward compatible, so we urge you to use them preferentially.

In this chapter we’ll learn to create hooks and discuss their most common uses.

Our chapter topics include these items:

  • Creating a Hook
  • Overriding Web Resources
  • Customizing JSPs by Extending the Original
  • Customizing Sites and Site Templates with Application Adapters
  • Performing a Custom Action
  • Overriding and Adding Struts Actions
  • Extending and Overriding
  • Overriding a Portal Service
  • Overriding a file
  • Extending the Indexer Post Processor
  • Other Hooks

Like portlets, layout templates, and themes, hooks are created and managed using the Plugins SDK, or the terminal. Let’s create and deploy a hook using both environments.

Creating a Hook

Regardless of whether you use the Plugins SDK or your terminal to create hooks, hooks projects are stored in the Plugins SDK’s hooks directory. Using Developer Studio: Go to File → New → Liferay...

Read More

Overriding web resources

Hooks are commonly used to override web resources, found in portal-web in the Liferay source. You can use a hook to override JSP files, JSPF files, JavaScript files, or images. Important: A JSPF...

Read More

Customizing JSPs by Extending the Original

If we can replace a JSP with a hook plugin, why learn another way to accomplish the same thing? Good question. Let’s say you want to preserve the original JSP’s content and functionality, but you...

Read More

Customizing Sites and Site Templates with Application Adapters

All the hooks we’ve demonstrated so far are scoped to the portal. What if you need to customize specific sites without propagating the customizations throughout the entire portal? You can!...

Read More

Performing a Custom Action

Hooks are useful for triggering custom actions on common portal events, like user log in or system start up. The actions for each of these events are defined in, so we’ll need to...

Read More

Extending and Overriding

In our hook that created a custom login action, we modified the portal property. This property accepts multiple values, so our value was appended to the existing

Read More

Overriding and Adding Struts Actions

Do you want to add a new Struts action to Liferay portal or override existing Struts actions? Struts action hooks let you do just that. Let’s consider the interfaces used for Struts actions. There...

Read More

Overriding a Portal Service

All the functionality provided by Liferay is enclosed in a layer of services that are accessed by the controller layer in portlets. This is a standard architecture, and it lets you change how a...

Read More

Overriding a File

Hooks let you change any of the messages displayed by Liferay, to suit your needs. To do so, create a Language file for the locale of the messages you want to customize, then refer to your file...

Read More

Extending the Indexer Post Processor

Would you like to modify the search summaries, indexes, and queries available in your portal instance? Developing an Indexer Post Processor hook lets you do just that. The indexer hook implements a...

Read More

Other hooks

Since hooks are the preferred plugin type for customizing Liferay’s core features, the Liferay team is happy to keep providing you new hooks. This section is a placeholder for hooks that are...

Read More


In this chapter we discussed some of the many uses of the versatile hook plugin, the preferred tool for customizing Liferay. You learned how to perform custom portal actions, override and extend...

Read More
0 (0 Votes)
Summary Previous