如何archetypes.schemaextenders
注册five.grok
.
尝试:
class QuickNavExtender(grok.Adapter):
"""
Define schema fiddler which injects a new field to every item.
"""
# This field comes on every AT content item
grok.adapts(ISchemaExtender)
grok.provider(ISchemaExtender)
grok.context(IBaseContent)
#adapts(IBaseContent)
implements(ISchemaExtender)
fields = [
ExtensionBooleanField("quicknav",
widget = atapi.BooleanWidget(
label="Quick jump navigation",
description="Allow in-page jumping by navigation links"
),
# On which edit tab this field appears
schemata = "settings"
)
]
...没有被捡起。
但是,如果您添加此 ZCML 片段并回退 Zope 3 样式注册,则它可以工作:
<adapter factory=".extender.QuickNavExtender"
provides="archetypes.schemaextender.interfaces.ISchemaExtender" />