views:

398

answers:

1

I am trying to customize the "Event" portlet in Plone 3 that shows the upcoming events. The "view" link in the footer of that portlet goes to the /events URL. But my site is multi-lingual so that URL is not always correct. For example, the correct URL for Dutch events should be /evenementen.

In my setup I use one folder per language. /en holds all English content, /nl holds all Dutch content, etcetera. The plone root has no portlets so I add the "Event" portlet to both the /nl and /en folder separately. I was looking in the ZMI at the events.pt template and it seems that it takes the URL from a property, but where is that property defines and how can I change it? I can't find the portlet configurations in the ZMI. Here is the snippet from plone.app.portlets.portlets/events.pt:

<dd class="portletFooter">
    <a href=""
       class="tile"
       tal:attributes="href view/all_events_link"
       i18n:translate="box_upcoming_events">
            Upcoming events&hellip;
    </a>
    <span class="portletBottomLeft"></span>
    <span class="portletBottomRight"></span>
</dd>

So, can I somewhere change that all_events_link property in the ZMI? If so, where?

As an alternative I have also tried to add a "Collection" portlet with a collection that lists all events. But the problem is that the collection portlet doesn't want to show the start and end dates for the events.

+1  A: 

The events portlet uses a view to provide it with data, and the expression 'view/all_events_link' calls a method on that view to provide it with a link. You have 2 options to replace that link:

  1. Register your own event portlet that subclasses the old one, and replaces the all_events_link method. This in the heavy customization option, and requires Python coding. See this mail thread on some general pointers on how to achieve this.

  2. Replace just the template with a portlet renderer. Martin Aspeli has documented this method on Plone.org; this only requires some ZCML configuration to get working. You can then copy the events.pt template and replace the portlet footer with one that links to the right location.

Martijn Pieters
Thanks. That looks useful. I will test it after the weekend.
Sander Marechal
The second method worked. I couldn't figure out how to change the link for each language so I simply removed the footer from the portlet all together.
Sander Marechal