@mickmackusa I did read those articles, but the solutions are not very pretty too. See my edited article with solution 2 and 3. Did I miss a solution? Atm I would prefer solution 2.
– svanschuMay 6 at 21:42

You should probably be using data passed to onContentBeforeSave rather than data from input. Since the plugin is meant to be usable across multiple components, form control (jform) should not be hardcoded as it is configurable.
– SharkyMay 7 at 5:33

Then @Sharky it would be nice of you to tell me how to pass it there.
– svanschuMay 7 at 6:43

I'm not particularly familiar with com_fields but this would be done in onCustomFieldsPrepareDom. Both inputs (upload and override checkbox) should be a part of the XML form definition (currently the checkbox only appears in HTML markup). One way is to use subform (like Fields - Repeatable) or similar approach.
– SharkyMay 8 at 7:01

1 Answer
1

I agree that your "Solution 2" is better because it implements a more readable syntax.

I might be a little too nitpicky because I have been spending time volunteering at CodeReview, but perhaps you could clarify your variable naming. Your abbreviated naming is probably very clear to you, but it will make your code more readable for other developers if you avoid shortening your variable names. $choveride_res = "checkbox override result" and $res = "result" Mind you, I have seen far worse/ambiguous variable naming, I just think there is some benefit to be had from using a few more characters.