function bigmenu_slice_form_js in Big Menu 7
Same name and namespace in other branches
- 6 bigmenu.admin.inc \bigmenu_slice_form_js()
Return a submenu slice form in json format.
Menu callback, invoked by AJAX.
Drupals form cache would not allow me to insert arbitrary fields into a form without letting the server know about it.
1 string reference to 'bigmenu_slice_form_js'
- bigmenu_menu in ./
bigmenu.module - Declare admin links and AJAX callbacks.
File
- ./
bigmenu.admin.inc, line 161 - Administrative page callbacks for bigmenu module.
Code
function bigmenu_slice_form_js($menu, $menu_link, $form_id, $form_build_id) {
$depth = variable_get('bigmenu_depth', 1);
$form_state = form_state_defaults();
$old_form = drupal_get_form('bigmenu_slice_form', $menu, $menu_link, $depth);
$output = drupal_render($old_form);
// This returns data to the browser immediately.
drupal_json_output(array(
'status' => TRUE,
'data' => $output,
));
// After that we will do the slower job of updating the form cache.
// Reload the bigmenu_overview_form,
// with the same args (the menu name) as before.
$args = array(
$menu,
);
$form_state['build_info']['args'] = $args;
$form_state['values'] = array();
$form_state['rebuild_info']['copy']['#build_id'] = $form_build_id;
drupal_rebuild_form($form_id, $form_state, array(
'#build_id' => $form_build_id,
));
exit;
}