The HippoBean class has methods to get beans by relativ path and other means. It automatically handles the hippo:handles. So you can access a bean selected in a component by something like the following code:
My question is: Is there an easy way to always get the live version of documents? At least in our site the provided code seems to always catch the first of the child nodes of the hippo:handle which tends to be the draft variant.
In most of my use cases I’d prefer getting the live variant or null if the document is currently not published
this is transparently handled for you and it is based on user session/jcr session…it should only get draft (preview) variant if you are using preview session (if you are logged into CMS for example and accessing document via channel manager)…otherwise, something is wrong with your setup, either on user level (security domains) or you marked your mount as a preview mount
Alright I’ll have a look at that and circle back. I was asking because we somehow managed to get an unpublished document displayed in our live site. Might have been a cache or setup issue.