Hi,

I have developed new module for Webform - Webform Multiple File. Module provides new webform component, that allows users to upload multiple files. I know, that exist Webform Multiple File Upload, but the goal of my module - it works in Drupal way without JS and external libraries. Design of my module similar to file field widget, that allows correct validation and file processing.

During development of Webform Multiple File I found bug #2153695: Incorrect key for component_value set. Also it's necessary to deliver data about uploaded files in implementation of _webform_render_component() every time during element rendering. I tried to find method without patching Webform module, but it's seems to be unreal. And I decided to add one new line in webform.module.

With this patch every implementation of _webform_render_component() will receive components value from $form_state in $value parameter. Patch doesn't break any common webform component and provides more flexibility.

Correct me, please, if I'm wrong. I really want to publish my module :)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Chalk’s picture

Chalk’s picture

Hi,

Is there any news, questions?

quicksketch’s picture

Status: Needs review » Fixed
FileSize
1.65 KB

The basic effect of this patch was already addressed in #1215456: Multiple and same-page conditional rules. Your patch has this state:

     $data = isset($submission->data[$cid]['value']) ? $submission->data[$cid]['value'] : NULL;
+    $data = isset($component_value) ? $component_value : $data;

But in Webform 4.x this line is now:

    $data = isset($input_values[$cid]) ? $input_values[$cid] : NULL;

Essentially, the same thing as your patch. However this brings up that we really should be using $component_value anyway, but $input_values[$cid] is the same as $component_value anyway. I've committed this patch which further cleans up our use of $input_values vs. $component_value. Functionally it makes no difference but increases the consistency of where we use which variables.

For Webform 3.x, I don't think we're going to making this change, as its data model is a bit more fragile and I'm worried about what problems would cause. This effectively may result in an unexpected API change. I'd recommend you simply have your module required Webform 4.x.

I'm marking this "fixed" since it's already working in Webform 4.x, but for 3.x, this is really "won't fix".

Status: Fixed » Closed (fixed)

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

fenstrat’s picture

Version: 7.x-3.x-dev » 8.x-4.x-dev
Assigned: Unassigned » fenstrat
Status: Closed (fixed) » Patch (to be ported)

Needs porting to 8.x-4.x.

fenstrat’s picture

Version: 8.x-4.x-dev » 7.x-4.x-dev
Assigned: fenstrat » Unassigned
Status: Patch (to be ported) » Fixed

Committed and pushed f9c1d75 to 8.x-4.x. Thanks!

  • Commit e195430 on 8.x-4.x authored by quicksketch, committed by fenstrat:
    Issue #2153723 by quicksketch: Form_state values in...

Status: Fixed » Closed (fixed)

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