function webfm_attach_attached_form in Web File Manager 5
Same name and namespace in other branches
- 5.2 webfm.module \webfm_attach_attached_form()
1 call to webfm_attach_attached_form()
- webfm_form_alter in ./
webfm.module - Implementation of hook_form_alter().
1 string reference to 'webfm_attach_attached_form'
- webfm_links in ./
webfm.module
File
- ./
webfm.module, line 756
Code
function webfm_attach_attached_form($node) {
$form['#theme'] = 'webfm_attach_attached_form';
// This form input (id = edit-attachlist) will hold the comma-separated
// ordered list of attached fids. We need to store the attachments (which
// might not yet been saved to the database) in two cases:
// 1) A form_validate fails when trying to save/preview. The form is not
// rebuild by form_alter, but form values are refilled. #value => '' would
// delete the attachlist collected so far, so use #default_value => '' instead.
$form['new']['attachlist'] = array(
'#type' => 'hidden',
'#default_value' => '',
);
// 2) If form_validate didn't fail, the form is rebuild with form_alter
// and the value is reset. But we have the list in the POST parameters.
// Use default_value here, too, so that it can still be changed if we get
// a form_validate error *after* a successful preview.
if ($_POST['attachlist']) {
$form['new']['attachlist']['#default_value'] = $_POST['attachlist'];
}
return $form;
}