This is an attempt to get some of the improvements I’ve offered in #2117285: Allow extra data to be added to submissions in result displays into digestible packets.

I propose to extend the API for the submission information in two ways:

  1. Add additional $node and $options parameters to hook_webform_results_download_submission_information_info().
  2. Add an additional hook hook_webform_results_download_submission_information_data_row() that works like hook_webform_results_download_submission_information_data() except that it allows the callee to return all columns for one submission at once.

Both changes to the API are fully backwards compatible.

Comments

torotil created an issue. See original summary.

torotil’s picture

Issue summary: View changes
torotil’s picture

Issue summary: View changes
torotil’s picture

Status: Active » Needs review
StatusFileSize
new8.04 KB

In addition to the API changes the patch migrates webform’s own implementation of hook_webform_results_download_submission_information_data() to hook_webform_results_download_submission_information_data_row().

torotil’s picture

Issue summary: View changes
torotil’s picture

r-mo’s picture

Status: Needs review » Needs work

Applying this patch causes all standard submission information to be removed from the result set.

A little debugging reveals the information is returned correctly by webform_results_download_submission_information_data_row but is then deleted by the per token hook as there is now no return value for the webform_sid, webform_time etc tokens.

I suspect the if (isset($data[$token])) was intended to be if !isset but this would prevent modules altering any results from data_row on a per token basis.

torotil’s picture

Status: Needs work » Needs review
StatusFileSize
new7.87 KB

Thanks for taking a look at my patch!

but this would prevent modules altering any results from data_row on a per token basis.

True, I’ve created a new patch that should fix both issues. It invokes the old alter-hook for all token values regardless of how the data is provided.

torotil’s picture

I would love to see this API improvement go into one of the next releases. I think all issues mentioned in #7 are solved in #8. On top I think this improves exporter performance quite a bit.

liam morland’s picture

Status: Needs review » Needs work

The API needs to be backward-compatible. webform_webform_results_download_submission_information_data() is not a private function, so it needs to continue to work. The new parameters to hook_webform_results_download_submission_information_info() need default values.

torotil’s picture

Status: Needs work » Needs review
StatusFileSize
new8.01 KB
new2.35 KB

Ah, this is indeed relevant if other modules invoke hook_webform_results_download_information_info(). I have changed the hook implementation to have only optional parameters and a comment stating why they are here.

torotil’s picture

Is there still a chance of getting this in at this point?

torotil’s picture

StatusFileSize
new8.14 KB

Here is a re-roll against the current 7.x-4.x branch.

liam morland’s picture

Status: Needs review » Closed (outdated)

Drupal 7 is no longer supported. If this applies to a supported version, please re-open.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.