Neil Drumm wrote:
Adrian Rossouw wrote:
1 ) introduce a hook_forms. which registers each of the forms on the site. 2 ) register all the forms, and their inputs and create callbacks for them
What would this list be used for?
the idea here is to present a directory to developers of all the forms that they can programmatically submit. For all the user forms, I just browse the forms registered under /user. This is just a directory, not used by the code.
function mymodule_forms() { $form['mymodule/form_id'] = array( 'callback' => 'mymodule_form_id', 'access' => user_access('can do form_id'),
Shouldn't this be handled in ..._validate() or hook_menu()?
we are not wanting to mess with menu system just yet.
3 ) put the form creation code into it's own function, with the registered callback
Maybe in it's own file too, along with ..._validate, ..._submit, etc. Less code to include up front. Something along the lines of path_to_module/forms/form_id.form.php would get auto-included.
maybe. lets see how we do getting all the theme files separated out and modules in own directories.
4) alter fapi to not use _POST at all. Instead use a parameter that is passed to it, which merely defaults to _POST.
Would the form creation code need to set #value itself then?
no, this would still happen in form_build
function mymodule_forms() { $form['mymodule/form_id'] = array( 'callback' => 'mymodule_form_id', 'access' => user_access('can do form_id'),
Shouldn't this be handled in ..._validate() or hook_menu()?
'title' => 'form title'
What would the title do?
just for the directory. i still think this is a much needed improvement