You are here

function multiple_node_menu_js in Multiple Node Menu 6

1 string reference to 'multiple_node_menu_js'
multiple_node_menu_menu in ./multiple_node_menu.module
Implementation of hook_menu()

File

./multiple_node_menu.module, line 37

Code

function multiple_node_menu_js($delta = 0) {
  $form = multiple_node_menu_ajax_form_handler($delta);
  $multiple_menu_form = $form['menu']['multiple_node_menu']['menu_links'];

  // Prevent duplicate wrappers.
  unset($multiple_menu_form['#prefix'], $multiple_menu_form['#suffix']);

  // render the form. status includes validation messages from the rest of the form
  // $output = theme('status_messages') . drupal_render($multiple_menu_form);
  $output = drupal_render($multiple_menu_form);

  // make sure AHAH is attached
  $javascript = drupal_add_js(NULL, NULL);
  if (isset($javascript['setting'])) {
    $output .= '<script type="text/javascript">';
    $output .= 'jQuery.extend(Drupal.settings, ' . drupal_to_js(call_user_func_array('array_merge_recursive', $javascript['setting'])) . ');';
    $output .= '</script>';
  }

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