I think the documentation for #after_build is in error for Drupal 6. If you have CVS-access and believe the suggested change is correct, please committ it.
The important part is the parameters to the function that should be changed from ($form, $form_element) to ($form_element, &$form_state).
I have attached a patch against the full html file found trough viewvc, but do you really edit it that way - without a preprocessor like Doxygen?
A more human-readable form of the suggestion follows here:
----------------
#after_build
An array of function names which will be called after the form is built.
Usage example (system.admin.inc and system.module):
$form['file_directory_path'] = array(
'#type' => 'textfield',
'#title' => t('File system path'),
'#default_value' => file_directory_path(),
'#maxlength' => 255,
'#description' => t('A file system path where the files will be stored. This directory must exist and be writable by Drupal. If the download method is set to public, this directory must be relative to the Drupal installation directory and be accessible over the web. If the download method is set to private, this directory should not be accessible over the web. Changing this location will modify all download paths and may cause unexpected problems on an existing site.'),
'#after_build' => array('system_check_directory'),
);
...
function system_check_directory($form_element, &$form_state) {
file_check_directory($form_element['#value'], FILE_CREATE_DIRECTORY, $form_element['#parents'][0]);
return $form_element;
}
Another example is node_body_field which uses node_teaser_js.
Property names without # signs causes havoc.
| Comment | File | Size | Author |
|---|---|---|---|
| diff-forms_ref_after_build.diff | 6.95 KB | emok |
Comments
Comment #1
ezyang commentedThe correction looks correct; and yes, those files are hand-edited. Which I find hilarious, because there's syntax coloring in the HTML. :-)
Comment #2
brunodboComment #3
Barry Madore commentedMoving
Comment #4
betz commentedChanged the component to reflect the new component categorization. See http://drupal.org/node/301443
Comment #7
Anonymous (not verified) commentedThe last submitted patch failed testing.
Comment #8
jhodgdonThis has already been fixed, apparently.