How best to add to the HomepageComponents config option

Hi,

We have a locally developed portlet that I’d like to add to the HomepageComponents variable so that our users can add it to their RT home page.

I can obviously do this by copying the setting of HomepageComponents from RT_Config.pm to RT_SiteConfig.pm and adding our component there. I think that is what is suggested in Writing portlets - RT 5.0.2 Documentation - Best Practical. But I’d need to be careful to keep our copy of HomepageComponents synchronized with the one in RT_Config.pm if I did that. So I was wondering if there is a better way?

I believe $HomepageComponents is an arrayref so in theory I should be able to push my portlet name on to the referenced array if it was already initialized with the default values. But I’m not sure where I could do that, since I think RT_SiteConfig.pm is read before RT_Config.pm so doing it in our site configuration wouldn’t work.

Are there any callbacks that could be used (ie: after LoadConfig() has run but before Init() is called)?

If not, an option I’ve considered but not yet explored would be to define a local plugin that existed solely to add our portlet name to the HomepageComponents arrayref. Is it worth exploring that option - ie: would our plugin initialization happen early enough for it to have an effect?

Any other thoughts would be appreciated.

Thanks,

Duncan

We just put what we need into our local version of the RT_SiteConfig.pm (and indeed into a load of split out config files in /opt/rt5/local/etc/RT_SiteConfig.d as well). When upgrading we have to check the distributed configuration in case there are new features we do/don’t want turned on, or for things that were extensions that are now in core, so we’d be reviewing the local config at that point anyway.

1 Like