Problem/Motivation
I've generated a simple example to demonstrate:
Say we don't want users able to delete nodes they have created, but instead we have a webform where they can request a specific node they created to be removed. We would get notified and remove it for them if we approve. The webform contains an element that uses a view to show a list of nodes the current user is the last revision author for, so they can select from that list and submit. That element of course references a specific view and passes a token for the current user to the view for the argument.
Steps to reproduce
Create an entity reference view that requires an argument (example bug_view yaml file included)
Create a webform that Entity Checkboxes populated by that view, passing an argument. (example bug_webform yaml file included)
Edit the Entity Checkboxes element, choose the Conditions tab, and attempt to add a row to the state or another state.
Nothing happens.
If you view the network activity, you can see behind the scenes an error was thrown (and in the Drupal logs):
TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in implode() (line 164 of /web/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php)
Proposed resolution
I'm not sure where the error originates. The value that should be an array is the string argument given in the View Arguments setting of the webform element. Suggest altering line 164 from:
$default = !empty($view_settings['arguments']) ? implode(', ', $view_settings['arguments']) : '';
to:
$default = !empty($view_settings['arguments']) && is_array($view_settings['arguments'] ? implode(', ', $view_settings['arguments']) : '';
In my case I can work around this time by using the view default argument to pull the logged in userid and set the webform element argument as empty. The solution needs to accommodate multiple view arguments, which my recommendation does if the user comma separates them.
Remaining tasks
User interface changes
API changes
Data model changes