Plone: Eigener Footer mit portal_actions
In diesem Beispiel wollen wir ein Viewlet für den Footer erstellen, der über die portal_actions befüllt werden kann.
browser/viewlets.py
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from plone.app.layout.viewlets.common import ViewletBase
from zope.component import getMultiAdapter
class FooterActionsViewlet(ViewletBase):
index = ViewPageTemplateFile('footer_actions.pt')
def update(self):
context_state = getMultiAdapter((self.context, self.request),
name=u'plone_context_state')
self.footer_actions = context_state.actions().get('footer_actions', None)
browser/footer_actions.pt
<ul id="portal-footeractions" tal:condition="view/footer_actions"> <li>© Ihr Firmenname</li> <li class="footeractions" tal:repeat="faction view/footer_actions" tal:attributes="id string:footeraction-${faction/id}">• <a href="" tal:define="title faction/title; id faction/id;" i18n:attributes="title" i18n:translate="" tal:content="title" tal:attributes="href faction/url; title title;"> Footer action </a> </li> </ul>
browser/configure.zcml
<browser:viewlet name="my.skin.footer_actions" manager="plone.app.layout.viewlets.interfaces.IPortalFooter" layer=".interfaces.IThemeSpecific" class=".viewlets.FooterActionsViewlet" permission="zope2.View" />
profiles/default/viewlets.xml
<order manager="plone.portalfooter" skinname="My Skin"> <viewlet name="my.skin.footer_actions" /> </order>
profiles/default/actions.xml
<?xml version="1.0"?> <object name="portal_actions" meta_type="Plone Actions Tool" xmlns:i18n="http://xml.zope.org/namespaces/i18n"> <action-provider name="portal_actions" /> <object name="footer_actions" meta_type="CMF Action Category"> <property name="title"></property> </object> </object>