You are here

public static function WebformGroupRoles::processSelect in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_group/src/Element/WebformGroupRoles.php \Drupal\webform_group\Element\WebformGroupRoles::processSelect()

Processes a webform roles (checkboxes) element.

Overrides Select::processSelect

File

modules/webform_group/src/Element/WebformGroupRoles.php, line 37

Class

WebformGroupRoles
Provides a webform group roles element.

Namespace

Drupal\webform_group\Element

Code

public static function processSelect(&$element, FormStateInterface $form_state, &$complete_form) {
  $element['#options'] = static::getGroupRolesOptions($element);
  $element['#select2'] = TRUE;

  // Must convert this element['#type'] to a 'select' to prevent
  // "Illegal choice %choice in %name element" validation error.
  // @see \Drupal\Core\Form\FormValidator::performRequiredValidation
  $element['#type'] = 'select';
  WebformElementHelper::process($element);
  return parent::processSelect($element, $form_state, $complete_form);
}