Problem/Motivation
When visiting tab "Settings" of a webform, the following error shown up in the browser:
"The website encountered an unexpected error. Please try again later."
Steps to reproduce
1. Install Drupal 10.1.0-rc1 with the standard profile in use.
2. Install module webform 6.2.0-beta6.
3. Visit page http://127.0.0.1/admin/structure/webform/manage/contact/settings (assuming that you have the Drupal site installed locally).
4. Now check "Recent log messages" ( http://127.0.0.1/admin/reports/dblog ). The following record found: "Error: [] operator not supported for strings in Drupal\webform\Utility\WebformDialogHelper::attachLibraries() (line 63 of web/modules/contrib/webform/src/Utility/WebformDialogHelper.php)."
Line 63 of file "WebformDialogHelper.php" contains the following code:
$build['#attached']['library'][] = 'webform/webform.admin.dialog';
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 3367466-8.patch | 690 bytes | jrockowitz |
| #7 | fix-undefined-key-errory-3367466-7.patch | 784 bytes | biancaradu27 |
| #6 | 3367466-6.patch | 690 bytes | jrockowitz |
| #2 | 3367466-2.patch | 609 bytes | jrockowitz |
Comments
Comment #2
jrockowitz commentedI am not sure I will be able to replicate the issue but the attached patch should fix it.
Comment #3
jrockowitz commentedComment #4
deminyThanks for taking a look at the issue so quickly. I gave the patch a try but unfortunately the issue still exists. It seems that array field $build['#attached']['library'] already exists as a string (and thus it won't be overidden). Here is a customized change I made:
The log contains the following:
Comment #5
deminyI took a look at Drupal core and noticed the following MR created for issue #2253257 (Use a modal for entity delete operation links):
https://git.drupalcode.org/project/drupal/-/merge_requests/3700/diffs#8d...
And, here is the merged commit for that issue:
https://github.com/drupal/drupal/commit/bab4e14492b807364137f4b4075c86cb...
Hope it helps.
Comment #6
jrockowitz commentedThat helps a lot.
The below code is a mistake coming from Drupal Core.
...it should be...
You should file a new major issue and add a note to #2253257: Use a modal for entity delete operation links.
For now, I can provide a reasonable patch workaround.
Comment #7
biancaradu27 commentedAfter applying the patch I get this error Warning: Undefined array key "#attached" in Drupal\webform\Utility\WebformDialogHelper::attachLibraries() (line 64 of modules/contrib/webform/src/Utility/WebformDialogHelper.php). So I added a fix to this patch. My core version is 10.1 and webform "drupal/webform": "^6.2@beta".
Comment #8
jrockowitz commentedComment #9
jrockowitz commented