public static function WebformTable::processTable in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Element/WebformTable.php \Drupal\webform\Element\WebformTable::processTable()
#process callback for #type 'table' to add tableselect support.
Parameters
array $element: An associative array containing the properties and children of the table element.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
array $complete_form: The complete form structure.
Return value
array The processed element.
Overrides Table::processTable
File
- src/
Element/ WebformTable.php, line 27
Class
- WebformTable
- Provides a render element for webform table.
Namespace
Drupal\webform\ElementCode
public static function processTable(&$element, FormStateInterface $form_state, &$complete_form) {
// @see \Drupal\Core\Render\Element\Table::getInfo
$element['#input'] = TRUE;
$element['#tableselect'] = FALSE;
$element['#tabledrag'] = FALSE;
$element['#tree'] = FALSE;
// Add .webform-table class to the table element.
$element['#attributes']['class'][] = 'webform-table';
// Remove 'for' attribute from form wrapper's label.
$element['#label_attributes']['webform-remove-for-attribute'] = TRUE;
// Add webform table CSS.
$element['#attached']['library'][] = 'webform/webform.element.table';
return $element;
}