This module is great! But sometimes I don't want to apply the 'check all' behavior to a field. Without needing to breakout an annoying form_alter, can this be set at the field level?

Comments

brooke_heaton created an issue. See original summary.

brooke_heaton’s picture

Just follow up, I think this really needs to be set in the widget settings so that it can be applied on a field-specific basis. Lacking that, the functionality is WAY too broad and assuming/destructive.

mlncn’s picture

Status: Active » Postponed (maintainer needs more info)

Yeah right now it's hard-coded to provide the Check All and Toggle buttons for any set of checkboxes with with more than five options.

I would very happily accept patches or merge requests to make the threshold number configurable (or do myself, that's trivial enough for me to do!).

If that's not sufficient, i would also welcome the functionality you request, putting this in the form widget display. I think i'd want this in an optional submodule, so the 80% use case ("give me a check all button if there are a lot of checkboxes") can be achieved without more third party settings pollution in the config or the UI.

brooke_heaton’s picture

Attached patch utilizes thirdPartySettings to allow each individual field to override the 'check all' functionality. This is provided in the form display field settings - unchecking the box and saving will remove the 'Check all' and 'Toggle' buttons from the field. This will keep existing functionality and all fields with options greater than 5 will have the 'Check all' UNLESS this checkbox is unchecked. This will preserve legacy functionality.

Screenshot of new checkboxes widget settings showing new setting field to not show the check all button

brooke_heaton’s picture

Component: User interface » Code
Assigned: Unassigned » brooke_heaton
Status: Postponed (maintainer needs more info) » Needs review

  • mlncn committed c26e00c on 8.x-1.x authored by brooke_heaton
    Issue #3098160 by brooke_heaton: Allow unsetting checkall on specific...
mlncn’s picture

Status: Needs review » Fixed

OK, it's committed!

I'll either learn to live with the third-party settings spamming every field, or if not i reserve the right to move this to a submodule.

  • mlncn committed 79c31b8 on 8.x-1.x
    Issue #3098160 by mlncn: Prevent undefined index error while allowing...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.