You are here

function feeds_tamper_ui_js in Feeds Tamper 6

Ajax callback for add form.

1 string reference to 'feeds_tamper_ui_js'
feeds_tamper_ui_menu in feeds_tamper_ui/feeds_tamper_ui.module
Implementation of hook_menu().

File

feeds_tamper_ui/feeds_tamper_ui.admin.inc, line 504
Forms and their accompanying validation and submit functions for Feeds Tamper UI.

Code

function feeds_tamper_ui_js() {
  $form_state = array(
    'storage' => NULL,
    'submitted' => FALSE,
  );
  $form_build_id = $_POST['form_build_id'];
  $form = form_get_cache($form_build_id, $form_state);
  $args = $form['#parameters'];
  $form_id = array_shift($args);
  $form_state['post'] = $form['#post'] = $_POST;
  $form['#programmed'] = $form['#redirect'] = FALSE;
  $form_state['submitted'] = TRUE;
  if (!isset($_POST['op'])) {
    $form['#validate'] = array();
    $form['#submit'] = array();
  }
  drupal_process_form($form_id, $form, $form_state);
  $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
  $plugin_form = $form['plugin'];
  unset($plugin_form['#prefix'], $plugin_form['#suffix']);

  // Prevent duplicate wrappers.
  $javascript = drupal_add_js(NULL, NULL, 'header');
  $settings = call_user_func_array('array_merge_recursive', $javascript['setting']);
  drupal_json(array(
    'status' => TRUE,
    'data' => theme('status_messages') . drupal_render($plugin_form),
    'settings' => $settings,
  ));
}