I would like to alter the default settings for the file component of webform - reduce the default upload size and insert a default subdirectory.
The defaults are defined in file.inc, _webform_defaults_file()
I've looked through all the documentation I could find, and unfortunately I've been unable to figure out how another module can alter those defined defaults. (I can use webform_file_restrict_form_webform_component_edit_form_alter to alter the resulting form, but I'm not sure if it's possible to change the default values there. When I tried, (i.e. $form['validation']['size']['#default_value'], it set the form value to the default value all the time and ignored changes.
Would anyone know?
Thanks in advance!
Comments
Comment #1
quicksketchHi there! This isn't currently possible. We have a patch that is under consideration at #2013523: Add an alter hook for component defaults to add this functionality. In the mean time the only approach is to use hook_form_alter() like you've done already. I'm marking this issue a duplicate of that other issue.
Comment #2
pq commentedIn the meantime, you can get your code to work by changing it to something like this:
You might have to inspect the $component to make sure that $component['validation']['size'] is correctly nested and change if not.