portal_tab globalnav customization

portal_tab, or globalnav, or global_section in Plone, provides clickable links. Let's say, we want a tab to open in new browser window when clicked. The trick is in plone.app.layout/viewlets/sections.pt.

<ul id="portal-globalnav"
    tal:define="selected_tab python:view.selected_portal_tab"
    ><tal:tabs tal:repeat="tab portal_tabs"
    ><li tal:define="tid tab/id;
                     turl tab/url"
         tal:attributes="id string:portaltab-${tid};
                        class python:selected_tab==tid and 'selected' or 'plain'"
        ><a href=""
           tal:attributes="href tab/url;
                           title tab/description|nothing;
                           target python: (turl.endswith('/my-url') and '_blank' or '')">
        Tab Name

No comments: