« Back

Extending an AssetRendererFactory

Company Blogs January 27, 2012 By Juan Fernández Staff


Many of you know a lot and do an extensive use of the Asset Framework, the framework within Liferay Portal that "provides a set of functionalities that are common to several different content types".
In many projects we find that developers need to extend the behaviour of the AssetRendererFactories to fit their needs, and, even it is not that hard, it takes a while to think on the best and cleaner way to achieve this. 
In a recent forum post, a user asked how to modify the UserAssetRendererFactory and I decided to write down the steps in a wiki article to share it with the rest of the community. 
Here's the link, but for the most impatients, here are the steps to do:
1.- Create an ext plugin
2.- Add the portlet you want to modify/extend to liferay-portlet-ext.xml 
3.- Make <asset-renderer-factory> point to your custom class
4.- Create a class that extends the original AssetRendererFactory and the add or modify the methods you need
5.- Deploy, restart the server and you are ready to go! :)
That's it!
I hope this is useful for you
Juan Fernández
Threaded Replies Author Date
Hi Juan, Thanks to post. Question: can... Jonas Yuan January 27, 2012 10:21 AM
Hi Jonas: I agree that would be much better.... Juan Fernández January 31, 2012 12:52 AM
thanks for this! very helpfull, but! where I... Pablo Pereyra July 10, 2012 1:02 PM

Hi Juan, Thanks to post.

Question: can AssetRendererFactory be hook-able? Hook plugin would be better solution.
Posted on 1/27/12 10:21 AM.
Hi Jonas:
I agree that would be much better. Maybe in a future release. You could open a ticket to request that feature.
Posted on 1/31/12 12:52 AM in reply to Jonas Yuan.
thanks for this! very helpfull, but! where I add the class and how?
Posted on 7/10/12 1:02 PM.