问题
I have a folder called myfolder, that has some items inside, like: item1, item2, item3, and etc.
When I added the portlet Navigation to the left column of the page, and entered on the folder myfolder, it showed me the links on the portlet like this:
- item1
- item2
- item3
I want that the Navigation portlet shows me links on this exact sort:
- item2
- item1
- item3
I know that I can go on the Content tab of myfolderenter code here, and drag each item to the position that I want.
But using this way, if I reinstall all my product on a new Plone Site, I lost my configuration. So I want to have this navigation order configured on my product, instead of only on a installed plone site, so that this change stays forever.
How can I do that?
回答1:
Solved: I could solve this by doing under the installation of the product:
#file: Extensions/Install.py
def install(portal):
#...another steps from install
portal = getToolByName(portal, 'portal_url')
portal = portal.getPortalObject()
portal.moveObjectsToTop(['item2', 'item1', 'item3', ])
portal.plone_utils.reindexOnReorder(portal)
Just this.
来源:https://stackoverflow.com/questions/3668539/plone-how-to-sort-folder-items