a big topic to me is how to manipulate fields of another behavior.
for example i want to "replace" (hide and still use) the description with a richtext field.
the contenttypes consists of idublincore - that might change in the future, but thats another story - where the description is implemented.
i want to create an additional behavior; my.richdescription.
this has a richtextfield and should hide the description on its own.
@provider(IFormFieldProvider)
class IRichDescription(model.Schema):
rich_description = RichTextField(
title=_(u'label_description', default=u'Summary'),
description=_(
u'help_description',
default=u'Used in item listings and search results.',
),
required=False,
missing_value=u'',
)
form.order_after(rich_description="IDublinCore.title")
to hide the description i would need:
form.mode(description='hidden')
that doesn't work, as description is not a variable of IRichDescription.
form.mode(IBasic, description='hidden')
should do the trick, after reading the code of plone.autoform
https://github.com/plone/plone.autoform/blob/master/plone/autoform/directives.py#L67-L69
BUT...
https://github.com/plone/plone.supermodel/blob/master/plone/supermodel/directives.py#L80-L91
only looks for fields in its own schema and never touches self.value, which has a tupe with the necessary infos:
self.values -> [(<SchemaClass ...IBasic), 'description', 'hidden']
looks good, doesn't it?
nothing in the check() methods considers looking up those interfaces and if that is a field inside.
sadly.
if it would, one could simply create a richdescription without subclassing ibasic, removing dublincore from all types, adding this subclassed ibasic, publication, ownership and copyright behaviors, just for simply hidding one small field.
a big topic to me is how to manipulate fields of another behavior.
for example i want to "replace" (hide and still use) the description with a richtext field.
the contenttypes consists of idublincore - that might change in the future, but thats another story - where the description is implemented.
i want to create an additional behavior; my.richdescription.
this has a richtextfield and should hide the description on its own.
to hide the description i would need:
that doesn't work, as description is not a variable of IRichDescription.
should do the trick, after reading the code of plone.autoform
https://github.com/plone/plone.autoform/blob/master/plone/autoform/directives.py#L67-L69
BUT...
https://github.com/plone/plone.supermodel/blob/master/plone/supermodel/directives.py#L80-L91
only looks for fields in its own schema and never touches
self.value, which has a tupe with the necessary infos:looks good, doesn't it?
nothing in the check() methods considers looking up those interfaces and if that is a field inside.
sadly.
if it would, one could simply create a richdescription without subclassing ibasic, removing dublincore from all types, adding this subclassed ibasic, publication, ownership and copyright behaviors, just for simply hidding one small field.