#table (and #tableselect) form element should merge, not ignore existing child items

Created on 30 September 2013, over 11 years ago
Updated 11 April 2024, 11 months ago

In form_process_table() and form_process_tableselect():

    foreach (element_children($element) as $key) {
      // Do not overwrite manually created children.
      if (!isset($element[$key]['select'])) {

This is the opposite of the behaviour of checboxes and radios elements.

With those, it's established and desired behaviour that the #process callback for the element merges in any existing child elements. This allows you to do things like add description to single radio buttons or checkboxes, or mark them disabled:

  $form['checkboxes'] = array(
    '#type' => 'checkboxes',
    '#options' => $options,
  );
  // Make the foobar option disabled for some reason.
  $form['checkboxes']['foobar']['#disabled'] = TRUE;
  // The bizbax checkbox needs further description.
  $form['checkboxes']['foobar']['#description'] = t('More details here');

This is not possible with tableselect / table, because they specifically skip existing child elements.

πŸ› Bug report
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component
FormΒ  β†’

Last updated 23 minutes ago

Created by

πŸ‡¬πŸ‡§United Kingdom joachim

Live updates comments and jobs are added and updated live.
  • Needs backport to D7

    After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    There hasn't been any work here for 9 years. I think it is time to check in and find out if this is still relevant to Drupal 10.

    Since we need more information to move forward with this issue, I am setting the status to Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

  • Status changed to Closed: outdated 2 months ago
  • πŸ‡¦πŸ‡ΊAustralia griffynh Sydney

    As we haven't had an update for nine monthsβ€”I'm going to close this issue.

    Please feel free to reopen if there is any new information.

Production build 0.71.5 2024