Search code examples
hippocms

How to get a ChannelManager from within a Component


I'm looking for a way to fetch a ChannelManager ref from within a Component#doBeforeRender call, in a somewhat similar way to the QueryManager.

Is there a *Manager registry I can ask for service interfaces?

Best, Edoardo


Solution

  • go to ChannelManager and find usages of it. It will give you enough hits..like:

    public static ChannelManager getChannelManager() {
        ComponentManager componentManager = HstServices.getComponentManager();
        if (componentManager == null) {
            return null;
        }
    
        return HstServices.getComponentManager().getComponent(ChannelManager.class.getName());
    

    }