LRP-614 practice question 3 of 25

A hook plugin can be used to: (Please select all correct answers.)

Full set: 144 questions
Answer options
A: Modify a portal language key Correct answer
B: Modify a theme plugin
C: Override a portal JSP Correct answer
D: Override the User service Correct answer
E: Override PortalLDAPUtil
Correct Answer:
A. Modify a portal language key; C. Override a portal JSP; D. Override the User service
Explanation

Liferay hook plugins are a hot-deployable and minimally invasive way to customize Liferay Portal. A hook can be used to modify language keys by providing a custom Language.properties file, which overrides the default portal translations. One of the most common uses for hooks is to override core portal JSPs, allowing developers to change the portal's user interface. Hooks can also override core services, such as the User service, by implementing a service wrapper. This wrapper intercepts calls to the original service, allowing for the addition of custom logic before or after the original method execution.

Why Incorrect

B. A hook cannot modify a theme plugin. Themes are a separate plugin type and are customized by creating a new theme or directly modifying the existing one.
E. Overriding core utility classes like PortalLDAPUtil is not possible with a hook. This level of customization requires an Ext plugin, which can replace core portal classes.

References

1. Liferay Portal 6.1 Developer's Guide, Chapter 10: Hooks.

For A (Language Keys): Section "Customizing Language Keys", Page 221: "You can use a hook to customize the language keys defined in Liferay’s Language.properties files."

For C (JSP Override): Section "Customizing JSPs", Page 222: "One of the most powerful features of hooks is the ability to override and customize Liferay’s JSPs."

For D (Service Override): Section "Overriding a Portal Service", Page 218: "You can use a hook to override one of Liferay’s core services... This is accomplished by creating a service wrapper."

For E (Incorrect - Utility Class): Section "When to Use an Ext Plugin", Page 238: "If you need to override a Liferay class that’s not a service, you should use an Ext plugin." This clarifies that utility classes are outside the scope of hooks.

Scroll to Top