Problem

When utilizing the webform ecosystem for any advanced application such as event registration, application portal or employee performance evaluations, it is often required that the submission results tab be manipulated to show different data based on what roles are viewing the information.

Solution

With views in core and with the Webform Views Integration modules being stable, providing a default view with a dependency on Webforms Views Integration, would give site-builders a powerful tool to build submission results interfaces. This view could utilize views url's to override the tab.

Feature Requests

  • Default View: A default view that Overrides the Submission Results Tab
  • Additional Tab: Provide an example view that creates an additional results tab. To be used if people want different tabs to show for different permissions, roles etc.
  • Override Results View Per Webform or Webform Node: Allow default view to only override results tab of specific webforms or specific webform nodes. To be used if a user only wants to override the results tab of Event #2. Maybe using views url to override the results tab.

Additional Notes

  • This feature was one of the highest requested features of the Entity Registration module, with over 100 comments and 70 followers this is an important feature. I can see many Entity Registration users utilizing webforms for events, due to lack of event registration modules available for Drupal 8.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kclarkson created an issue. See original summary.

kclarkson’s picture

Issue summary: View changes
kclarkson’s picture

Issue summary: View changes
jrockowitz’s picture

Assigned: Unassigned » jrockowitz

  • jrockowitz committed c6e63cb on 2993327-views
    Issue #2993327: Provide Default View to Override Submission Results Tab
    

  • jrockowitz committed 5025e3b on 2993327-views
    Issue #2993327: Provide Default View to Override Submission Results Tab...

  • jrockowitz committed e0df828 on 2993327-views
    Issue #2993327: Provide Default View to Override Submission Results Tab.
    

  • jrockowitz committed 417e744 on 2993327-views
    Issue #2993327: Provide Default View to Override Submission Results Tab.
    

  • jrockowitz committed c9f8dba on 2993327-views
    Issue #2993327: Provide Default View to Override Submission Results Tab.
    

  • jrockowitz committed 34237e3 on 2993327-views
    Issue #2993327: Provide Default View to Override Submission Results Tab.
    
jrockowitz’s picture

Status: Active » Needs review
FileSize
137.61 KB

The attached patch has no test coverage. I just need to confirm that it is not breaking anything.

Status: Needs review » Needs work

The last submitted patch, 11: 2993327-11.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

  • jrockowitz committed 2762a48 on 2993327-views
    Issue #2993327: Provide Default View to Override Submission Results Tab...
jrockowitz’s picture

Status: Needs work » Needs review
FileSize
137.83 KB

Status: Needs review » Needs work

The last submitted patch, 14: 2993327-14.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

  • jrockowitz committed 16cbcb8 on 2993327-views
    Issue #2993327: Provide Default View to Override Submission Results Tab...

  • jrockowitz committed ce069a0 on 2993327-views
    Issue #2993327: Provide Default View to Override Submission Results Tab...
jrockowitz’s picture

Status: Needs work » Needs review
FileSize
358.11 KB

  • jrockowitz committed 0843e08 on 2993327-views
    Issue #2993327: Provide Default View to Override Submission Results Tab...

  • jrockowitz committed 20d470f on 2993327-views
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 5d82504 on 2993327-views
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed abacd91 on 2993327-views
    Issue #2993327: Provide Default View to Override Submission Results Tab...

  • jrockowitz committed 46c46ad on 2993327-views
    Issue #2993327: Provide Default View to Override Submission Results Tab...

  • jrockowitz committed ec64905 on 2993327-views
    Issue #2993327: Provide Default View to Override Submission Results Tab...
jrockowitz’s picture

Status: Needs review » Needs work

The last submitted patch, 23: 2993327-23.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

  • jrockowitz committed 87a6042 on 2993327-views
    Issue #2993327: Provide Default View to Override Submission Results Tab...

  • jrockowitz committed ea51c12 on 2993327-views
    Issue #2993327: Provide Default View to Override Submission Results Tab...

  • jrockowitz committed 605a8a6 on 2993327-views
    Issue #2993327: Provide Default View to Override Submission Results Tab...

  • jrockowitz committed 838e897 on 2993327-views
    Issue #2993327: Provide Default View to Override Submission Results Tab...

  • jrockowitz committed 0406a8c on 2993327-views
    Issue #2993327: Provide Default View to Override Submission Results Tab...
jrockowitz’s picture

Status: Needs work » Needs review
FileSize
413.17 KB

Status: Needs review » Needs work

The last submitted patch, 30: 2993327-30.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

  • jrockowitz committed 3d9ae39 on 2993327-views
    Issue #2993327: Provide Default View to Override Submission Results Tab...
jrockowitz’s picture

Status: Needs work » Needs review
FileSize
414.22 KB

  • jrockowitz committed 0406a8c on 8.x-5.x
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 0843e08 on 8.x-5.x
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 16cbcb8 on 8.x-5.x
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 20d470f on 8.x-5.x
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 2762a48 on 8.x-5.x
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 34237e3 on 8.x-5.x
    Issue #2993327: Provide Default View to Override Submission Results Tab.
    
  • jrockowitz committed 3d9ae39 on 8.x-5.x
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 417e744 on 8.x-5.x
    Issue #2993327: Provide Default View to Override Submission Results Tab.
    
  • jrockowitz committed 46c46ad on 8.x-5.x
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 5025e3b on 8.x-5.x
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 5d82504 on 8.x-5.x
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 605a8a6 on 8.x-5.x
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 838e897 on 8.x-5.x
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 87a6042 on 8.x-5.x
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed abacd91 on 8.x-5.x
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed c6e63cb on 8.x-5.x
    Issue #2993327: Provide Default View to Override Submission Results Tab
    
  • jrockowitz committed c9f8dba on 8.x-5.x
    Issue #2993327: Provide Default View to Override Submission Results Tab.
    
  • jrockowitz committed ce069a0 on 8.x-5.x
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed e0df828 on 8.x-5.x
    Issue #2993327: Provide Default View to Override Submission Results Tab.
    
  • jrockowitz committed ea51c12 on 8.x-5.x
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed ec64905 on 8.x-5.x
    Issue #2993327: Provide Default View to Override Submission Results Tab...
jrockowitz’s picture

I just messed up and merged 2993327-views with 8.x-5.x and I reverted the changes and will create a new branch.

  • jrockowitz committed 417e744 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab.
    
  • jrockowitz committed 5025e3b on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed c6e63cb on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab
    
  • jrockowitz committed c9f8dba on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab.
    
  • jrockowitz committed e0df828 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab.
    
  • jrockowitz committed 0406a8c on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 0843e08 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 16cbcb8 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 20d470f on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 2762a48 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 34237e3 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab.
    
  • jrockowitz committed 3d9ae39 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 46c46ad on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 5d82504 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 605a8a6 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 6951e8e on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab.
    
  • jrockowitz committed 838e897 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 87a6042 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed abacd91 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed ce069a0 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed ea51c12 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed ec64905 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...

  • jrockowitz committed 417e744 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab.
    
  • jrockowitz committed 5025e3b on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed c6e63cb on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab
    
  • jrockowitz committed c9f8dba on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab.
    
  • jrockowitz committed e0df828 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab.
    
  • jrockowitz committed 0406a8c on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 0843e08 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 16cbcb8 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 20d470f on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 2762a48 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 34237e3 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab.
    
  • jrockowitz committed 3d9ae39 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 46c46ad on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 5d82504 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 605a8a6 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 6951e8e on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab.
    
  • jrockowitz committed 838e897 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed 87a6042 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed abacd91 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed ce069a0 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed ea51c12 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
  • jrockowitz committed ec64905 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...

  • jrockowitz committed be3371a on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
jrockowitz’s picture

Hopefully, this final patch passes all the tests and this change can now be reviewed.

I created a change record to help people understand how views integration is set up.

A few notes about the original feature request.

  • It is difficult and hacky to provide additional result tabs for each view which is why multiple views are displayed in a dropdown.
  • Overriding an individual webform node's results with a view is not support but could easily done via code. For example, it is possible to write hook that looks for an 'embed_node_NID' view display id and dynamically override a webform node's results with that view display.

  • jrockowitz committed d7d492c on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab.
    

  • jrockowitz committed 8bbc4f1 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...

  • jrockowitz committed 1d0b06f on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
jrockowitz’s picture

  • jrockowitz committed 7e252e9 on 2993327-views-01
    Issue #2993327: Provide Default View to Override Submission Results Tab...
bucefal91’s picture

Cool video out there! :)

I reviewed your branch and also checked it out locally to actually execute your code. While reviewing your code I found this spot, which looks like a logical "misspelling" to me (it's WebformSubmissionListBuilder):

    $displays = $view->storage->get('display');
    if (isset($displays[$display_id]['display_options']['arguments'])) {
//////// In both branches of of this IF statemente you're doing the same assignment.
/////// I believe you meant rather
////// display_arguments = $displays[$display_id]['display_options']['arguments'];
////// in the line below.
////// So that way you take the "current" $display_id arguments if they are available and
////// the default ones otherwise.
      $display_arguments = $displays['default']['display_options']['arguments'];
    }
    else {
      $display_arguments = $displays['default']['display_options']['arguments'];
    }

As I told you in an email, in webform views I also at some point faced a similar task, but actually the implementation (and needs of our client) were slightly different. There we would let the client build a normal view for a webform A and have its URL be /form/webform-a/my-cool-view, then they'd expect this view to nicely integrate with routing, i.e. display local tabs in both directions: when you're on the URL form/webform-a, among others, there must be the tab that leads to the view.. and other way around, whenever you open /form/webform-a/my-cool-view we had to show all "normal" webform tabs.

Then they'd repeat the same for webform B (and would place it under URL /form/webform-b/my-cool-view-or-any-other-url) and would expect again this new view to nicely integrate with the Routing system. The condition was that they are placing such views as a "subfolder" of the main webform route. But we did not substitute the pre-existing routes.

I assume I could refresh my memories about how I managed routing in webform views for that part (actually the stuff I described above is part of webform_views, I decided to put it into a contrib module instead of just keeping in a custom one within the project; hoping that one day I'll have time to polish it and allow users to do some cool stuff on top of that). So I could refresh my memories and maybe offer a way to inject the submission views as a tabs and not as a dropdown list. But to be frank, it would mean a 3rd level of tabs and I do not think that is UX-friendly. I actually liked the dropdown list you have placed :)

jrockowitz’s picture

@bucefal91 Good catch on the coding mistake.

I did not see any clean way to implement a third level and/or dynamic tabs to display webform submission views, especially because several admin themes have different ways of handling local tasks (aka tabs).

Views ability to add new local tasks/tabs to existing menu items and tabs is very limited. If have found any solution that helps solve this problem, please consider contributing it back as code or documentation.

  • jrockowitz committed ced0210 on 2993327-views-01
    Issue #2993327 by jrockowitz: Provide Default View to Override...
bucefal91’s picture

And do you want to provide these tabs as 3rd level or append them to the 2nd level? By "3rd level" I mean more or less like you have done it right now with dropdown links but just to convert it to look&feel of tabs whereas by "2nd level" I mean to have the following tabs:

  • Submissions
  • Download
  • Clear (up to here are the own webform tabs)
  • Submission view A (these and all the below are the views that are enabled as submission views)
  • Submission view B

As the views can be injected on multiple routes, the 1st part of the tabs (the "webform own" tabs as I called them) would vary depending on the current route but still the logic stays the same: display "webform own" tabs whatever they are and then append the submission views tabs, if any, for the current route.

To be honest I prefer to append to the 2nd level because having 3 levels of tabs sounds like a little bit confusing to me but I do not insist on my preference since I am not a UX expert :)

kclarkson’s picture

Alex,

would you still have the functionality to allow the dropdown? I like how jrockowitz had it as a dropdown if you wanted to use both tabs.

Also with your option would you be able to override the default submissions tab? That was really the key ingredient that I needed so that end users are not tempted to hit the wrong tab.

I owe both Alex and Jake a few beers, so come to Atlanta in November :)

jrockowitz’s picture

Both options can be supported. Right now only the dropdown is supported via the UI. Adding additional tabs requires some custom code.

I agree with the approach from #48. Ideally, the Views related tabs would appear after the 'Submissions' tab.

I am going to commit this patch now.

  • jrockowitz committed e655720 on 8.x-5.x
    Squashed commit of the following:
    
    commit...
jrockowitz’s picture

Status: Needs review » Fixed
kclarkson’s picture

@jrock,

to use webform views though you need to use the dev version correct?

jrockowitz’s picture

Yes, I'll be tagging the next release next week.

Status: Fixed » Closed (fixed)

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