Postponed on #3487726: FormElement tableselect is incompatible with #tabledrag
Contrib implementation in: #3487683: Add "Check all" functionality (switch to "tableselect") (also postponed on the core issue)

Problem/Motivation

OptionsButtonsWidget provides the

Check boxes/radio buttons

field widget.

Sadly, in contrast to EntityReferenceAutocompleteWidget those checkboxes / radios are not sortable, while they are still stored with delta value in the database already.
Switching to EntityReferenceAutocompleteWidget is not an option for UX reasons often, if you want to show all available options to the user.

So currently you don't have best of both worlds combined in the UI for the user as widget:

As Drupal already provides the wonderful tableselect FAPI element and already stores the delta in database, it should be relatively easy and benefitial to provide a "Sortable check boxes/radio buttons" widget in core.

Steps to reproduce

Proposed resolution

Provide a "Sortable check boxes/radio buttons" widget in core to allow not only (bulk) checking checkboxes option but also allow sorting the values (delta) if needed.

Remaining tasks

  1. Discuss
  2. Implement
  3. Test
  4. Release

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3487697

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

anybody created an issue. See original summary.

anybody’s picture

Title: Add a sortable checkboxes widget (tableselect) as OptionsButtonsWidget alternative » Add a sortable checkboxes widget (tableselect) as advanced OptionsButtonsWidget alternative
anybody’s picture

anybody’s picture

Issue summary: View changes

I tried implementing this in contrib first (Options Table module) but had to give up on this core issue: #3487726: FormElement tableselect is incompatible with #tabledrag

anybody’s picture

Status: Active » Postponed

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.