Tableselect

class Tableselect

Provides a form element for a table with radios or checkboxes in left column.

Properties:

  • #header: An array of table header labels.
  • #options: An associative array where each key is the value returned when a user selects the radio button or checkbox, and each value is the row of table data.
  • #empty: The message to display if table does not have any options.
  • #multiple: Set to FALSE to render the table with radios instead checkboxes.
  • #js_select: Set to FALSE if you don't want the select all checkbox added to the header.

Other properties of the \Drupal\Core\Render\Element\Table element are also available.

Usage exam