collective / wildcard.media

13 stars 12 forks source link

WIP adding a behavior for optional video and optional audio #62

Open pigeonflight opened 5 years ago

pigeonflight commented 5 years ago

This is work in progress. The goal is to provide two new behaviours.

These allow a user to add audio or video fields to their content type as a behaviour without them being mandatory/required.

pigeonflight commented 5 years ago

so far the implementation is ugly as it it doesn't follow "DRY" principles. The new Video (Optional) and Audio (Optional) behaviours are near duplicates of the old Video and Audio behaviours. I'd love to have suggestions for something more elegant.

As Andreas Jung has said. "breaking a behavior with a compound of multiple fields into a different behavior with less fields (e.g. when you want to get rid of a field) is not easy.. I tend to create a new behavior (with code duplication)"

see: https://community.plone.org/t/override-a-schema-provided-by-a-behavior/8347/3?u=pigeonflight