How to show a hidden viewlet

I'm trying to customize a Plone site created using a policy package that hides the navigation menu using the following code:

I can't do that using the /@@manage-viewlets view as the viewlet is shown on a different way and the Show link does nothing:

is there any way to overcome this limitation and show again the viewlet TTW?

Wild, wild guess:

  1. Change Theme to one that shows it
  2. Go to /@@manage-viewlets
  3. In another window: Change theme back to the 'correct'
  4. Click on the 'show' link that (maybe) showed when you changed theme.

I solved it the following way:

  • go to portal_setup on ZMI
  • select the Export tab
  • select Viewlet Settings and Export selected steps
  • edit the resulting viewlets.xml file inside the tarball and remove the statement that hides the plone.global_sections viewlet
  • select the Tarball Import tab and import the new settings (it has to be also in tarball format)
  • done

The viewlet is now available again.

2 Likes

Just by removing the hidden made it work, you didn't need to add an <order tag?

I've never used the Tarball import before because it's behavior it's different from using a profile installation.

yes, I just removed the hidden tag and that made the work; I had to create a tarball file and I don't know if it's possible to skip that and upload just an XML.

I'm trying to do the same, but programmatically following these instructions or with registered profile and remove="True" instruction

Both are not working, can someone share me how to do it? I need to write an upgrade step to show again the viewlet.

I tested using the storage utility (IViewletSettingsStorage) and it worked fine for me, but I removed the viewlet from all skins and not only from the default:

(Pdb) from zope.component import queryUtility
(Pdb) from plone.app.viewletmanager.interfaces import IViewletSettingsStorage
(Pdb) storage = queryUtility(IViewletSettingsStorage)
(Pdb) storage._hidden
{u'Plone Default': {u'plone.portalfooter': (u'doormat.footer.bare',), u'plone.portalheader': (u'plone.global_sections',)}, u'Plone Classic Theme': {u'plone.belowcontent': (u'plone.belowcontenttitle.keywords',), u'plone.portalfooter': (u'plone.site_actions',), u'plone.portalheader': (u'plone.personal_bar', u'plone.app.i18n.locales.languageselector'), u'plone.abovecontent': (u'plone.path_bar',)}, 'Sunburst Theme': {'plone.portalheader': ()}}
(Pdb) storage._hidden.keys()
[u'Plone Default', u'Plone Classic Theme', 'Sunburst Theme']
(Pdb) storage.getHidden('plone.portalheader', 'Plone Default')
(u'plone.global_sections',)
(Pdb) storage.getHidden('plone.portalheader', 'Plone Classic Theme')
(u'plone.personal_bar', u'plone.app.i18n.locales.languageselector')
(Pdb) storage.getHidden('plone.portalheader', 'Sunburst Theme')
(u'plone.global_sections',)
(Pdb) storage.setHidden(u'plone.portalheader', u'Plone Default', ())
(Pdb) storage.getHidden(u'plone.portalheader', u'Plone Default')
()
(Pdb) storage.setHidden(u'plone.portalheader', u'Sunburst Theme', ())
(Pdb) storage.getHidden(u'plone.portalheader', u'Sunburst Theme')
()
(Pdb) storage._hidden
{u'Plone Default': {u'plone.portalfooter': (u'doormat.footer.bare',), u'plone.portalheader': ()}, u'Plone Classic Theme': {u'plone.belowcontent': (u'plone.belowcontenttitle.keywords',), u'plone.portalfooter': (u'plone.site_actions',), u'plone.portalheader': (u'plone.personal_bar', u'plone.app.i18n.locales.languageselector'), u'plone.abovecontent': (u'plone.path_bar',)}, 'Sunburst Theme': {'plone.portalheader': ()}}

you have to figure out how to get the names of all available skins to avoid accessing a private attribute (_hidden).

1 Like

This is the final code, thank you everyone:

https://github.com/plonegovbr/brasil.gov.portal/blob/2.0/src/brasil/gov/portal/upgrades/v10804/init.py#L23-L31

1 Like