- Merge request !799fix: #3567475 Use correct variable for Select2 custom options → (Open) created by Tuuuukka
In https://git.drupalcode.org/project/webform/-/blob/6.3.x/js/webform.eleme... you can see that $input is used, but it's actually never defined This leads to an error in console when you add data-options attribute to the corresponding element:
Uncaught ReferenceError: $input is not defined
The element also turns in to a regular element instead of a Select2 element.
Apply this diff:
diff --git a/src/Element/WebformPermissions.php b/src/Element/WebformPermissions.php
index dc0ebb3f9..86375f199 100644
--- a/src/Element/WebformPermissions.php
+++ b/src/Element/WebformPermissions.php
@@ -43,6 +43,7 @@ class WebformPermissions extends Select {
}
$element['#options'] = $options;
$element['#select2'] = TRUE;
+ $element['#attributes']['data-options'] = json_encode(['placeholder' => 'Select something']);
// Must convert this element['#type'] to a 'select' to prevent
// "Illegal choice %choice in %name element" validation error.
Open up any form and go to Settings -> Access. Here you can see that the Permissions fields are not working as they should and that there's the error in console.
Use $select instead of $input, as that's the element we want to target here.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.