-
Notifications
You must be signed in to change notification settings - Fork 50
Form system
The form system allows users to submit data. To create a form, implement hook_form(). Modules can alter forms defined elsewhere by implementing hook_form_alter(). To get a form Form System : Data Structure for $form_id, call crm_get_form($form_id). To render html for the form structure $form, call theme('form', $form).
To create a form with id "foo", define a function foo_form($opts) that returns a Form System : Data Structure.
To extend a form supplied by another module, implement hook_form_alter($form, $form_id, $opts). Every time a form is rendered, this function will be called first. $form is the Form System : Data Structure, and $form_id is the form id string. This function must return $form.
To get a Form System : Data Structure for the form with id $form_id, call crm_get_form($form_id, $opts). All modules will have a chance to alter the form.
To render a form, pass it to theme('form', $form, $opts), which will return the themed html string.