+
+ foreach (static::$typesWithTitle as $type) {
+ $form['form_' . $type . '_title_no_xss'] = [
+ '#type' => $type,
+ '#title' => "$type <script>alert('XSS')</script> is XSS filtered!",
+ ];
+ // Add keys that are required for some elements to be processed correctly.
+ if (in_array($type, ['checkboxes', 'radios'], TRUE)) {
+ $form['form_' . $type . '_title_no_xss']['#options'] = [];
+ }
+ if ($type === 'datetime') {
+ $form['form_' . $type . '_title_no_xss']['#default_value'] = NULL;
+ }
+ }
+