function comment_upload_js in Comment Upload 5
Same name and namespace in other branches
- 6 comment_upload.module \comment_upload_js()
Menu-callback for JavaScript-based uploads.
1 string reference to 'comment_upload_js'
File
- ./
comment_upload.module, line 161
Code
function comment_upload_js() {
// We only do the upload.module part of the node validation process.
$comment = (object) $_POST;
// Load existing files.
$comment->files = _comment_upload_load_files($comment->cid);
// Handle new uploads, and merge tmp files into node-files.
_upload_prepare($comment);
_upload_validate($comment);
$form = _upload_form($comment);
// Swap upload/js for the comment_upload callback.
$form['attach-url']['#value'] = url('comment_upload/js', NULL, NULL, TRUE);
foreach (module_implements('form_alter') as $module) {
$function = $module . '_form_alter';
$function('upload_js', $form);
}
$form = form_builder('upload_js', $form);
$output = theme('status_messages') . drupal_render($form);
// We send the updated file attachments form.
print drupal_to_js(array(
'status' => TRUE,
'data' => $output,
));
exit;
}