You are here

function uc_dropdown_attributes_edit_callback in Dropdown Attributes 6

Callback for AHAH processing.

1 string reference to 'uc_dropdown_attributes_edit_callback'
uc_dropdown_attributes_menu in ./uc_dropdown_attributes.module
Implement hook_menu().

File

./dependent_dropdown.inc, line 46
Administrative interface for specifying the attribute dependencies.

Code

function uc_dropdown_attributes_edit_callback($aid) {
  $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;
  drupal_process_form($form_id, $form, $form_state);
  $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
  $changed_elements = $form['attributes'][$aid]['values-' . $aid . '-wrapper'];
  unset($changed_elements['#prefix'], $changed_elements['#suffix']);

  // Prevent duplicate wrappers.
  drupal_json(array(
    'status' => TRUE,
    'data' => theme('status_messages') . drupal_render($changed_elements),
  ));
}