Problem/Motivation

Besides multiple composite elements, advanced users should be able to build custom table containing individual elements.

@see https://drupal.stackexchange.com/questions/258478/populating-webform-tables

Proposed resolution

Add table support back into the Webform UI

Here a prototype of the YAML source

table:
 '#type': table
 '#header':
   - title: 'First Name'
     attributes: { }
   - title: 'Last Name'
     attributes: { }
   - title: Gender
     attributes: { }
   - title: 'US Citizen'
     attributes: { }
 '#row__key': table_row_{00}
 '#row__title': Table row {0}
 '#row__elements':
   table_{00}_first_name:
     '#title': '{0} - First name'
     '#title_display': invisible
     '#type': textfield
     '#size': 30
   table_{00}_last_name:
     '#title': '{0} - Last name'
     '#title_display': invisible
     '#type': textfield
     '#size': 30

Remaining tasks

  • Add markup support to composite widget
  • Add table webform element
  • Allow row elements to created in UI (w/ markup)
  • You must use 00 in the name of the row element so that each row element is incremented correctly.
  • Only allows table row elements to be added as children to table.
  • Add YAML source validation which ensures that 'table_row' can only be added to a 'table'
  • When table row is added to a table copy the elements and add indexes.
  • \Drupal\webform\Plugin\WebformElementInterface::getConfigurationFormProperties
  • Write tests
  • Write change record
  • Create video

User interface changes

  • webform_table element
  • webform_table_row element
  • 'Add row' page
  • Update the composite element builder

API changes

N/A

Data model changes

N/A

Release notes snippet

TBD

User Acceptance Test

  • Confirm Table row is not visible in 'Add element' UX.
    /admin/structure/webform/manage/table_test/element/add
  • Create a test webform
    /admin/structure/webform
  • Add Table element
  • Add Table row element
  • Add Textfield to table row
  • Add Elements to table row
  • Add Table row element with duplicate checked
  • Enable for Preview
    /admin/structure/webform/manage/{webform}/settings/form
  • Test the form and click 'Preview'
    /webform/{webform}/test
  • Check Table element #states support
  • Check Table row element #states support
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jrockowitz created an issue. See original summary.

  • 23a2a1d committed on 3119817-table-support
    Issue #3119817: Add table support back into the Webform UI
    

  • 38512f9 committed on 3119817-table-support
    Issue #3119817: Add table support back into the Webform UI. Setup HTML...

  • f1328a3 committed on 3119817-table-support
    Issue #3119817: Add table support back into the Webform UI. Setup HTML...

  • 114ff88 committed on 3119817-table-support
    Issue #3119817: Add table support back into the Webform UI. Cleanup and...
jrockowitz’s picture

Status: Active » Needs review
FileSize
37.08 KB

I just want to see if this patch is going to break anything.

  • af0a142 committed on 3119817-table-support
    Issue #3119817: Add table support back into the Webform UI. Fixing...
jrockowitz’s picture

Status: Needs review » Needs work

The last submitted patch, 8: 3119817-8.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

  • f4c6d6d committed on 3119817-table-support
    Issue #3119817: Add table support back into the Webform UI. Fixing...

  • c288fcc committed on 3119817-table-support
    Issue #3119817: Add table support back into the Webform UI. Fixing...
jrockowitz’s picture

Status: Needs work » Needs review
FileSize
40.75 KB
jrockowitz’s picture

Issue summary: View changes

  • 8ba7f9f committed on 3119817-table-support
    Issue #3119817: Add table support back into the Webform UI. Fix plain...

  • 5f49142 committed on 3119817-table-support
    Issue #3119817: Add table support back into the Webform UI
    

  • 4ecea23 committed on 3119817-table-support
    Issue #3119817: Add table support back into the Webform UI. Write...

  • 9ed0cb6 committed on 3119817-table-support
    Issue #3119817: Add table support back into the Webform UI. Write...
jrockowitz’s picture

Status: Needs review » Needs work

The last submitted patch, 18: 3119817-18.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

  • 4328547 committed on 3119817-table-support
    Issue #3119817: Add table support back into the Webform UI. Fix broken...

  • f0c1d8b committed on 3119817-table-support
    Issue #3119817: Add table support back into the Webform UI. Fix broken...
jrockowitz’s picture

Status: Needs work » Needs review
FileSize
58.86 KB

  • f5175fc committed on 3119817-table-support
    Issue #3119817: Add table support back into the Webform UI. Minor fixes...
jrockowitz’s picture

  • 315b5a6 committed on 3119817-table-support
    Issue #3119817 by jrockowitz: Add table support back into the Webform UI...

  • 6c2402a committed on 3119817-table-support
    Issue #3119817 by jrockowitz: Add table support back into the Webform UI...
jrockowitz’s picture

  • jrockowitz authored 80346ed on 8.x-5.x
    Issue #3119817 by jrockowitz: Add table support back into the Webform UI
    
jrockowitz’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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