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"

Comments

danjordan created an issue. See original summary.

jrockowitz’s picture

I 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 = [])

danjordan’s picture

Thanks Jacob.

Replacing $data = $values->_entity->getData();

with $webform_submission = $values->_entity;

and returning $webform_submission fixed the issue

jrockowitz’s picture

@danjordan If you have solution, please post a patch.

danjordan’s picture

StatusFileSize
new1.31 KB
jrockowitz’s picture

Status: Active » Needs review

Setting status to 'Needs review' to trigger automated testing.

floydm’s picture

Status: Needs review » Reviewed & tested by the community

I ran into the same fatal error today. The patch applied cleanly and fixed the issue. Marking this RTBC.

jase-alexander’s picture

Also applied the patch today as I was seeing the same issue. Patch resolved the issue for me.

astreib’s picture

Patch in comment #5 from danjordan resolved the error for me.

brynj’s picture

Same here. Any idea when this is going to get rolled into the module?

  • bucefal91 committed af74e68 on 8.x-5.x
    Issue #2882286 by danjordan, jrockowitz, floydm, jase-alexander, brynj,...
bucefal91’s picture

Status: Reviewed & tested by the community » Fixed

Sorry for not being responsive. I have just committed it along with other tickets that were required for matching interfaces of the 2 modules.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.