Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkerplugin ignores fields inside tagged values - sort of... #28

Open
iham opened this issue May 20, 2019 · 0 comments
Open

checkerplugin ignores fields inside tagged values - sort of... #28

iham opened this issue May 20, 2019 · 0 comments

Comments

@iham
Copy link
Member

iham commented May 20, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant