You are here

function taxonomy_menu_block_ajax_callback in Taxonomy menu block 7

Ajax callback function.

1 string reference to 'taxonomy_menu_block_ajax_callback'
_taxonomy_menu_block_form_options in ./taxonomy_menu_block.admin.inc
Expand normal Block add/edit form.

File

./taxonomy_menu_block.admin.inc, line 382
Admin functions and form settings for Taxonomy menu block module.

Code

function taxonomy_menu_block_ajax_callback(&$form, &$form_state) {
  $vid = $form_state['values']['vid'];
  $commands = array();

  // Get the correct form elements and add in new option values.
  $parent_fixed = $form['settings']['parent_fixed'];
  $parent_fixed['#options'] = taxonomy_menu_block_get_parents_fixed($vid);
  $parent_fixed = form_builder($form['#id'], $parent_fixed, $form_state);
  $commands[] = ajax_command_replace('#dropdown-fixed-parent', drupal_render($parent_fixed));
  $ctype = $form['settings']['node_options']['ctype'];
  $ctype['#options'] = taxonomy_menu_block_get_node_types($vid);
  $ctype = form_builder($form['#id'], $ctype, $form_state);
  $commands[] = ajax_command_replace('#node-types', drupal_render($ctype));
  return array(
    '#type' => 'ajax',
    '#commands' => $commands,
  );
}