This is a great question, and it points to something we should think about in the documentation: often we document how to code something, but we don't explain how to reverse-engineer our code, which is quite complex. The latter is a skill that is very important for beginning Plone developers, who often have to figure out how to find the proverbial needle in the haystack.
Without any claims of exhaustiveness, here is my answer for how to find what you are looking for. Kudos for finding that snippet in view_customizations, it is the key!
The "structure provider:plone.portalheader"
tells you that the HTML is inserted at that point by a viewlet manager called plone.portalheader
. From experience I know where that viewlet manager is, but what if I didn't know? I would do a recursive grep for plone.portalheader in the omelette folder, or in the eggs folder. (If you don't have omelette, or don't know what it is, google collective.recipe.omelette, and add it to your buildout if you don't have it already.) The grep yields several results, but not overwhelmingly so. The most relevant ones are the viewlets.xml files and the configure.zcml files. In fact, there is only one configure.zcml file in the grep results, which tells me that the plone.portalheader viewlet manager is registered by the distribution called plone.app.layout
.
Then you open the file plone/app/layout/viewlets/configure.zcml
and find out that the viewlet manager plone.portalheader provides the interface IPortalHeader
:
provides=".interfaces.IPortalHeader"
In the same file, search for IPortalHeader
, and you'll discover all the viewlets that are registered for that viewlet manager. For example, the viewlet with the name plone.global_sections
.
Some viewlets have the template defined right there in the zcml file. These, unfortunately, don't. So you look at the viewlet's class. The plone.global_sections
viewlet has:
class=".common.GlobalSectionsViewlet"
Go and open the file common.py
(in plone/app/layout/viewlets/
), and look for the class GlobalSectionsViewlet
. In it, you'll see:
index = ViewPageTemplateFile('sections.pt')
Boom! The sections.pt
file is the template for this viewlet, which is rendered by the viewlet manager, which is replaced in the snippet you found.
Now you should be able to find all the other viewlets and their templates. That's useful, but your next problem will be how to customize them. In some cases, you'll be able to find the viewlets in portal_view_customizations, and customize them right there TTW (through the web). In other cases, you'll have to learn how to create your own viewlet and register it to the same viewlet manager, and hide the viewlet your own viewlet is replacing. There is extensive documentation on how to do that (which is not to say it's easy).