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

changing mode of field in other different behavior #37

Open
iham opened this issue Nov 30, 2018 · 1 comment
Open

changing mode of field in other different behavior #37

iham opened this issue Nov 30, 2018 · 1 comment

Comments

@iham
Copy link
Member

iham commented Nov 30, 2018

how do i hide a field, thats not inside my behavior?

class IFancyDescriptionBehavior(model.Schema):
    fancydescription = RichText(...)
    directives.mode(description='hidden')

this does not work, as "description" is not a variable inside my behavior.
plonistas know: the description is delivered by the IBasic behavior (even more correct: by IDublinCore)

i know, i can:

  • subclass IBasic
  • add my desired field
  • remove idublincore from all <type_name>.xml > behaviors
  • add iowner, ipublication, icategories instead of idublincore
  • add my fancy behavior ifancybasic

... to ALL types!
and i loose the idublincore interface on all types.
which (maybe?) can lead to problems beyond my knowledge and reach.

well. thats a little much to ask for, just to simply hide a field, when my behavior is applied.

i have seen monkeypatches, subclassing and simple css as a solution, but all of them break instead of modify the system.

i'd like to see a simple solution like

directives.mode(mode='hidden', field='IBasic.fieldname')
or
directives.mode(mode='hidden', interface=IBasic, field='fieldname')
or
directives.mode(**{'IBasic.fieldname': 'hidden'})
or something like that

sadly i don't have the knowlege and time to do it on my own.

@jensens
Copy link
Member

jensens commented Nov 30, 2018

By design a behavior is not meant to change or interfere with other behavior, just because it is applied.

You can change a behavior on a global level, so it behaves consistently different. But in this case be sure all still works.

If IBasic does not do what you want, you need an own behavior providing a title and description (or no description at all).

And well, IDublinCore or plone.dublincore was in my opinion a mistake. It is just a collection of behaviors. I would really like to see it disappear and have the behaviors applied it consists of. It has no real value, but it makes code more complex, sometimes. Also, afaik, in code outside tests it is rarely referenced.

So, sorry, but I am -1 to add a feature like this.

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

2 participants