If you create a new view to show "webform submission" and save with default fields, it works as expected. As soon as you add a field from a webform, i.e. fields that become available after enabling this module, the view returns the following error.
Recoverable fatal error: Argument 2 passed to Drupal\webform\WebformSubmissionViewBuilder::buildElements() must implement interface Drupal\webform\WebformSubmissionInterface, array given, called in modules/contrib/webform_views/src/Plugin/views/field/WebformSubmissionField.php on line 103 and defined in Drupal\webform\WebformSubmissionViewBuilder->buildElements() (line 130 of modules/contrib/webform/src/WebformSubmissionViewBuilder.php).
I am using webform: "5.x-dev" and webform_views: "5.x-dev"
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | view_returns_error_when-2882286-5.patch | 1.31 KB | danjordan |
Comments
Comment #2
jrockowitz commentedI just recently updated the WebformElement plugin to support #2864843: Computed value element using Twig and/or tokens.
We now need to pass the WebformSubmission entity, instead of the value, to build and format methods.
For example, the below method...
WebformElementBase::build($format, array &$element, $value, array $options = [])...was changed to...
WebformElementBase::build($format, array &$element, WebformSubmissionInterface $webform_submission, array $options = [])Comment #3
danjordan commentedThanks Jacob.
Replacing
$data = $values->_entity->getData();with
$webform_submission = $values->_entity;and returning
$webform_submissionfixed the issueComment #4
jrockowitz commented@danjordan If you have solution, please post a patch.
Comment #5
danjordan commentedComment #6
jrockowitz commentedSetting status to 'Needs review' to trigger automated testing.
Comment #7
floydm commentedI ran into the same fatal error today. The patch applied cleanly and fixed the issue. Marking this RTBC.
Comment #8
jase-alexander commentedAlso applied the patch today as I was seeing the same issue. Patch resolved the issue for me.
Comment #9
astreib commentedPatch in comment #5 from danjordan resolved the error for me.
Comment #10
brynj commentedSame here. Any idea when this is going to get rolled into the module?
Comment #12
bucefal91 commentedSorry for not being responsive. I have just committed it along with other tickets that were required for matching interfaces of the 2 modules.