Plone: How to sort the navtree portlet using another list as base order?
I have a navtree on a plone site, already using this configuration:
navigation = mapping['navigation']
navigation.includeTop = True
navigation.currentFolderOnly = False
navigation.topLe开发者_如何学编程vel = 0
navigation.setProperty('metaTypesNotToList', ['ATBooleanCriterion', ...(another types go here) ..., MemberDataContainer'])
navigation.setProperty('idsNotToList',['Members', 'events'])
This results in a NavTree portlet that lists me this links: (the information into () are the ids of the elements, the ones we use when we don't want navtree to show then, putting then on the idsNotToList
variable under navtree_properties
)
- Home (I think this id is /root , but someone help me here telling me what is the exactly id resulted from the option:
navigation.includeTop=True
) - Help (/help)
- Search on bibliography (/searchbibliography)
- Statistics (/statistics)
Now what I want is sort this navtree using this another list (from ids) as pattern:
['root', 'searchbibliography', 'help', 'statistics']
so that NavTree order is exactly displayed as this given list order, showing me links like this:
- Home
- Search on bibliography
- Help
- Statistics
We see that there's no alphabetycal order here. There's exactly a specific order.
So, how can I do this?
Solved:
The ID of the root page is front-page
I could solve this by doing under the installation of the product:
def install(portal):
portal = getToolByName(portal, 'portal_url')
portal = portal.getPortalObject()
portal.moveObjectsToTop(['front-page', 'searchbibliography', 'help', 'statistics'])
portal.plone_utils.reindexOnReorder(portal)
Ordering the folder_contents
of my portal automatically ordered the navigation portlet (that uses the same order of the portal folder (i.e., folder_contents)).
精彩评论