You are here

public static function WebformTableTrait::processTableSelect in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Plugin/WebformElement/WebformTableTrait.php \Drupal\webform\Plugin\WebformElement\WebformTableTrait::processTableSelect()

Process table select and attach JavaScript.

Parameters

array $element: An associative array containing the properties and children of the tableselect element.

Return value

array The processed element.

See also

\Drupal\Core\Render\Element\Tableselect::processTableselect

File

src/Plugin/WebformElement/WebformTableTrait.php, line 139

Class

WebformTableTrait
Provides a 'table' trait.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public static function processTableSelect(array $element) {
  $element['#attributes']['class'][] = 'webform-tableselect';
  $element['#attributes']['class'][] = 'js-webform-tableselect';
  $element['#attached']['library'][] = 'webform/webform.element.tableselect';
  if (!empty($element['#required'])) {
    $element['#attributes']['class'][] = 'required';
  }
  $element['#attributes']['multiple'] = !empty($element['#multiple']);
  return $element;
}