How to add new collection criteria in Plone 5?

拈花ヽ惹草 提交于 2019-12-13 15:23:33

问题


I add a new choice field named course to Dexterity Content Type File in a new created instance. In order to use the field "course" as criteria in /++add++Collection, I follow this guide and add these to the file registry.xml in plone/buildout-cache/eggs/plone.app.querystring-1.3.14-py2.7.egg/plone/app/querystring/profiles/default/registry.xml:

<records interface="plone.app.querystring.interfaces.IQueryField"
       prefix="plone.app.querystring.field.course">
<value key="title">course</value>
<value key="description">A custom course index</value>
<value key="enabled">True</value>
<value key="sortable">False</value>
<value key="operations">
    <element>plone.app.querystring.operation.string.is</element>
</value>
<value key="group">Metadata</value>
</records>

But I can not find "course" in criteria list.

What can I do to get this criteria for collection?


回答1:


First of all: modify the Plone source code is a bad practice. Don't do it. Never.

The guide you are referring to is OK, but it's intended to be used in a new Plone add-on you must develop and add to your installation.

Please read the "Develop Plone Add ons" guide.

In your case: you need a really simple add-on with a simple generic setup step that contains a registry.xml file with your code above. After installing the add-on (and every time you will reinstall it) your registration will be added to your site.



来源:https://stackoverflow.com/questions/36734143/how-to-add-new-collection-criteria-in-plone-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!