using module_invoke_all to submit a form question

372 views Asked by At

here is more detailed explanation: i am using the ubercart module with the file download feature module (the uc_file module ). i have created a product class (which is a new content-type as far as the drupal system) and add a cck file field to it. what i want to achive is the following behavior: once a user saves a new node of my product class, i want the uploaded file to be added as a file download feature to the product class automatically. i know i can hack the function uc_file_feature_form_submit($form, &$form_state), do what it does in my module code, but i rather ivoke it since i'll have easier life with future changes to the uc_file module (since i am calling it's function, i dont care if it will change in the future). so, to invoke the uc_file_feature_form_submit function i need to build fake $form, &$form_state parameters, i know i can print_r those arrays, and build it from there, the thing is that there are a lot of data in those arrays that is not mandatory, i was wondering what are those mandatory fields that i have to build on my own. thank you...

2

There are 2 answers

2
mirzu On BEST ANSWER

Short answer: Look at the submit function you are trying to invoke. The form values that it's using are the ones you need.

Long answer . . . need more info before I can give a better answer.

0
Berdir On

You can use drupal_execute() to programatically execute a form. I am not sure if it works with files though.