Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: How can an asset publisher filter by just one calendar in a scope?
When using an asset publisher to display calendar events, is there a way to filter to a particular calendar instead of just all the calendars from within the scope? So if my parent site has two calendars, how can I make this asset publisher only show events of one of those two calendars?

Attachments:
Hi,
You can select manual selection instead of dynamic asset selection and choose the calendar events which all you want to show.
You can select manual selection instead of dynamic asset selection and choose the calendar events which all you want to show.
Hey Ben,The manual option the other community member proposed is one option, but I would avoid that as it sounds like a lot of manual work if you plan to make regular updates to the calendar. The short answer I think is "no"
.. but the beauty of Liferay is that there is almost always a way, even if it may be a little more indirect.Option #1: TagsI can see in your screenshot you are showing the tags. I have no idea what your requirement is, so I am going to call your two calendars "soccer" and "meetups". If you make sure to tag your events with either "soccer" or "meetups" then that should filter the items down for you. I know what you are thinking -- "ugh, but what if someone forgets?" .. fair point. You could pair that solution with a Service Wrapper that is used to intercept and change the definition of saving event entities (I think they are CalendarBooking models, but I am going from memory on that). When the item is being saved you can lookup the calendar and if the tag has not been added, then you could do it automatically. In fact, if you do something generic where you tag the items with the name of the calendar then it's all automated for you anyway. The nice thing about this is when you add a third calendar (which you also want to display in the assets list) everything you need is already there, you just need to update the Asset Publisher to include a second tag. It's a bit "hacky" in some respects, but it leverages the out of the box, asset api and a service wrapper -- all things that are bread and butter Liferay.
Option #2: Roll your ownAlternatively, you could roll your own portlet of course and then use the AssetEntryQuery to specify all the details you are after for filtering and such. In the end though I think you would end up with something pretty close to Option #1, but then you would also have to maintain the code and such. I'd start with #1 and only go this route as a fallback.

Option #2: Roll your ownAlternatively, you could roll your own portlet of course and then use the AssetEntryQuery to specify all the details you are after for filtering and such. In the end though I think you would end up with something pretty close to Option #1, but then you would also have to maintain the code and such. I'd start with #1 and only go this route as a fallback.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™