You are here

function matrix_ahah in Matrix field 6.2

Menu callback for AHAH form().

1 string reference to 'matrix_ahah'
matrix_menu in ./matrix.module
Implementation of hook_menu().

File

./matrix.module, line 1318
Defines simple matrix field types.

Code

function matrix_ahah() {
  $form_state = array(
    'storage' => NULL,
    'rebuild' => TRUE,
  );
  $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;
  drupal_process_form($form_id, $form, $form_state);
  $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
  print_r($form_state);
  $matrix_form = $form['matrixfield'];
  unset($matrix_form['#prefix'], $matrix_form['#suffix']);
  $output = theme('status_messages') . drupal_render($matrix_form);

  // Final rendering callback.
  drupal_json(array(
    'status' => TRUE,
    'data' => $output,
  ));
}