function _itweak_upload_process in iTweak Upload 6.2
Process upload form and add a progress bar. Code idea from [#389150]. Except: Using hooking mechanism that is a hack - we want to come in before #process on 'attach', but our _form_alter() is way too early - the upload modules have higher weight and come after our _form_alter() and wipe clean everything we need to change there. We need the lower weight so we can preview and act on file deletes. Ideal would be to have #process callback work on the form, but FAPI does not call it on forms, despite the documentation stating that it does. In fact, D6 code needs '#input'=TRUE on the element to get into calling #process callbacks. So we set '#input'=>TRUE on the form when inserting our callback into form['#process'], and it forces the FAPI to call that code path and we get our intercept. Works like a charm! _itweak_upload_process() is a dispatch. _itweak_upload_add_progressbar() is a worker.
1 string reference to '_itweak_upload_process'
- itweak_upload_form_alter in ./
itweak_upload.module - Implementation of hook_form_alter().
File
- ./
itweak_upload.module, line 1449 - iTweakUpload - Tweak attachments display and file upload forms.
Code
function _itweak_upload_process($element, $value, $form_state, $complete_form) {
if (isset($element['#itu']) && isset($element['attachments'])) {
$element['attachments']['wrapper'] = _itweak_upload_add_progressbar($element['attachments']['wrapper'], $form_state);
}
else {
$element = _itweak_upload_add_progressbar($element, $form_state);
}
return $element;
}