Skip to main content

FormStateInterface

Displaying 1 - 2 of 2

Form Element 'table' with TableDrag and TableSelect

Building and rendering a table required writing a custom/dedicated theme function for most tables in Drupal 7.

Drupal 8 introduces a new element '#type' => 'table', which comes with built-in, optional support for TableDrag and TableSelect, and which requires no more custom plumbing for most use-cases.

Note: The following conversion example shows both TableDrag and TableSelect in a single table for brevity, but they are usually not combined in a single table.

Building Forms Programmatically

Drupal provides a Form API in order to achieve consistency in its form processing and presentation while simplifying code and reducing the amount of HTML that a module must explicitly generate.

FormBuilder handles the low-level processing of forms such as rendering the necessary HTML, initial processing of incoming $_POST data, and delegating to your implementation of FormInterface to validate and process submitted data.