I've added a viewlet do be hidden in
viewlets.xml in an upgradeStep and executed portal_setup but it's not working since the viewlet it's still being rendered (even using
skinname="*" in the xml). Here's is what I did to see if the xml file was correctly imported:
- I added
?diazo.off=1 in my url, to be certain that Diazo isn't mangling stuff, but the viewlet is still rendered;
- I exported viewlets.xml from portal_setup and the viewlet is shown there as "hidden" but it's still being rendered.
I would like to know what else can I do to debug it to try to find what the hell is going on. Just for the sake of example, I'm trying to hide in my.package a viewlet that is registered in collective.package.
- Yes, in the correct manager. No, it doesn't appear in more than one manager.
- I don't like this approach when there's already the hidden machinery in place, and our Diazo rules are in a second package.
But somehow your post gave my an idea: the viewlet is in https://github.com/collective/collective.nitf/blob/a0b6ebf7fcda2cbcf60b4d4a48a42d53e4165c30/src/collective/nitf/browser/configure.zcml#L126, but there isn't a viewlets.xml in the package profile (https://github.com/collective/collective.nitf/tree/0808e73168a17fceb717acc925d02278c4fda76e/src/collective/nitf/profiles/default), only the zcml directive. How can I hide it using only zcml, create a new class and override it making
render method return
So, it seems that you can only try to use
hidden for a viewlet in viewlets.xml if it was prior registered in another viewlets.xml. Can anyone confirm this? Indeed this is what makes sense, I was only dreaming that if the xml did nothing a warning would have been nice.
seems to me you can't hide the viewlet because is bounded to the view in ZCML (check the
view directive below):
what's exactly what do you want to achieve? that package provides a view with no viewlet registered (
brasil.gov.portal customizes collective.nitf and we're upgrading from 1.x to 2.x there, but that big image in articles isn't expected in IDGB layout, so it needs to be hidden.
We can't use TextOnlyView because we need the
get_images method that is only at
Anyways, since you didn't give a layer, the simplest way was to customize the viewlet adding an empty template with our layer.
why can't you just remove it instead of hiding it ?
have you tried overriding it using another browser layer?
I guess you can also use
overrides.zcml in the context of your policy package.
This is a very specific case, we have a package named brasil.gov.portal that customized a browser view in collective.nitf 1.x. brasil.gov.portal will use collective.nitf 2.x, and that customized view now has an associated viewlet that isn't expected in the layout standards of brasil.gov.portal, so we need to hide it, and couldn't do it using viewlets.xml. We just don't know if it doesn't work because of what we think is the problem or what @hvelarde says.
This is not a problem with collective.nitf that it's going fine, it's with our package and our specific customization.
@hvelarde the solution for hiding can be achieved using overrides.zcml (which we think is overkill) but since you don't ask for collective.nitf's layer in your viewlet zcml registration we can just override it by putting in our zcml with our layer and an empty template.
We already know alternative ways to acomplish the task of hiding it, the motivation of this post is just to try to understand why viewlets.xml with
hidden doesn't work in specific cases.