Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lovely snippet for inclusion: overriding a portlet #118

Open
jean opened this issue Oct 25, 2012 · 0 comments
Open

Lovely snippet for inclusion: overriding a portlet #118

jean opened this issue Oct 25, 2012 · 0 comments
Assignees

Comments

@jean
Copy link
Member

jean commented Oct 25, 2012

Logging this here so it isn't forgotten.

On Thu, Oct 25, 2012 at 3:06 AM, Jens W. Klein [email protected] wrote:

On 2012-10-24 20:56, Tarlika Elisabeth Schmitz wrote:
I would like to display the items in the navigation portlet in reverse
chronological order.

Any advice how to achieve this would be greatly appreciated.

Best is to override navigation trees querybuilder.

The interface of this adapter is
plone.app.layout.navigation.interfaces.INavigationQueryBuilder

To achieve this just subclass default querybuilder, see
https://github.com/plone/plone.app.portlets/blob/master/plone/app/portlets/portlets/navigation.py#L294
and add the methods sortAttribute and sortOrder, ie.:.

from plone.app.portlets.portlets.navigation import QueryBuilder

class MyQuerybuilder(QueryBuilder):

    def sortAttribute(self):
       return 'created'

    def sortOrder(self):
       return 'reversed'

Then create and integrate (buildout -> zcml-overrides) an overrides.zcml
and register your adapter to replace the default one.

hth Jens
Klein & Partner KG, member of BlueDynamics Alliance

@pigeonflight pigeonflight self-assigned this Mar 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants