function node_gallery_upload_js in Node Gallery 6
1 string reference to 'node_gallery_upload_js'
- node_gallery_menu in ./node_gallery.module
- Implementation of hook_menu()
File
- ./node_gallery.pages.inc, line 100
- Node gallery pages.
Code
function node_gallery_upload_js() {
$cached_form_state = array();
$files = array();
if (!($cached_form = form_get_cache($_POST['form_build_id'], $cached_form_state)) || !isset($cached_form['#node']) || !isset($cached_form['upload_wrapper'])) {
form_set_error('form_token', t('Validation error, please try again. If this error persists, please contact the site administrator.'));
$output = theme('status_messages');
print drupal_to_js(array(
'status' => TRUE,
'data' => $output,
));
exit;
}
$form_state = array(
'values' => $_POST,
);
unset($cached_form['#node']->images);
node_gallery_upload_images($cached_form, $form_state);
if (drupal_get_messages(NULL, FALSE)) {
print drupal_to_js(array(
'status' => TRUE,
'data' => theme('status_messages') . drupal_get_form('node_gallery_upload_form'),
));
exit;
}
$form = node_gallery_edit_images_form($form_state, $cached_form['#node']);
$cached_form['edit_images'] = $form;
form_set_cache($_POST['form_build_id'], $cached_form, $cached_form_state);
$form += array(
'#post' => $_POST,
'#programmed' => FALSE,
'#tree' => FALSE,
'#parents' => array(),
);
$form_state = array(
'submitted' => FALSE,
);
$form = form_builder('node_gallery_upload_js', $form, $form_state);
print drupal_to_js(array(
'status' => TRUE,
'data' => theme('status_messages') . drupal_render($form),
));
exit;
}