If I change the viewlet manager for a viewlet, is it mandatory to use hidden in viewlets.xml?

I had a viewlet that was registered to plone.portaltop and present in viewlets.xml. Now, this viewlet needs to be registered on plone.portalfooter. This is simple to change, actually: I just need to change the manager in configure.zcml from plone.app.layout.viewlets.interfaces.IPortalTop to plone.app.layout.viewlets.interfaces.IPortalFooter, and it works.

Do I still need to create a viewlets.xml and use a hidden for the old manager, or is it safe to just change from portaltop to portalfooter in the configure.zcml? Since the order isn't important I don't plan to use a viewlets.xml anymore (specially because even without using "insert-before" or "insert-after" it mangles all the viewlets order).

Any thoughts? I'm using Plone 4.3.9.

If the viewlet is showing up in both places, then you will need to use viewlets.xml to hide it in portaltop.

If your site is using Diazo, then you can write a rule to just move the viewlet to the bottom instead of switching managers.

1 Like

or if you are lazy, go to /@@manage-viewlets and press hide

@cdw9 just by changing the manager in configure.zcml, it's not shown on portaltop anymore.

@espenmn like we said to @cdw9, it's not show anymore in portaltop since we changed the manager. My question is if there's any "danger" of having an old viewlet registration to a previous viewlet manager since we changed to the new viewlet manager only on configure.zcml and didn't use a hidden directive in a viewlets.xml.

We don't want stuff biting our foots on the future like browserlayers that weren't "correctly removed", similar to We need to stop using an add-on that registered a browserlayer. Which is the best way to do it and avoid pickling errors between upgradeSteps?. That's why we made this question.

My question is if there's any "danger" of having an old viewlet
registration to a previous viewlet manager since we changed to the new
viewlet manager only on configure.zcml and didn't use a hidden directive
in a viewlets.xml.

Since yours was a custom viewlet, just chaging the configuze.zcml moves it to the new manager. The problem of having it registered to multiple managers happens with viewlet overrides, since the override is pointing to a different manager than the original.

You can double check by exporting the viewlets.xml from portal_setup to see if the viewlet is only listed in the new manager.

1 Like