In a View of type "Webform Submissions", I have added a field called "Webform submission: Rendered entity". This displays the entire webform submission (content from all fields in the webform). My problem is that I have a few field elements in the webform that have create/view/update access permissions set to the Administrator role only. This is important because the webform is used by the Commerce Webform Order module to collect extended info for orders. The submitted results of those restricted fields are being displayed in the View.

The purpose of the View is to display the submitted contents of the webform in the Commerce receipt email. I do so with the following code in my order receipt template:

{{ drupal_view('my_view_name', 'block_1', order_entity.getOrderId) }}

As I stated, the restricted field results are being included in the Views output. In the "Webform submission: Rendered entity" field settings in the View, there is a selector called "View Mode" in which the only option is "Default". Is there a way to create a new View Mode for webform submissions, which would include only those fields that I choose? If so, I would be able to add the name, phone, etc fields and exclude the Admin-specific fields, and then select that alternate View Mode in the Views field settings. I have scoured the Webform settings in the back-end of the website, and I cannot find any opportunity to create that new View Mode for Webform Submissions.

1 Answer 1


WebformSubmission entities have only a few 'view modes', as defined in \Drupal\webform\WebformSubmissionViewBuilder::buildComponents method. Which means that if you want to have another one, you need to override WebformSubmission entity type view builder handler. These view modes are not exposed to views, so you need to provide your own views field handler as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.