You are here

function taxonomy_manager_update_term_data_form in Taxonomy Manager 6.2

Same name and namespace in other branches
  1. 5 taxonomy_manager.module \taxonomy_manager_update_term_data_form()
  2. 6 taxonomy_manager.admin.inc \taxonomy_manager_update_term_data_form()

menu callback for displaying term data form

if this function gets called by ahah, then the term data form gets generated, rendered and return otherwise, if no ahah call, redirect to original form with $vid and $tid as parameters

Parameters

$vid:

$tid:

$ahah if true, return rendered form, else redirect:

1 call to taxonomy_manager_update_term_data_form()
taxonomy_manager_term_data_edit in ./taxonomy_manager.admin.inc
callback handler for updating term data
1 string reference to 'taxonomy_manager_update_term_data_form'
taxonomy_manager_menu in ./taxonomy_manager.module
Implementation of hook_menu

File

./taxonomy_manager.admin.inc, line 795
Taxonomy Manager Admin

Code

function taxonomy_manager_update_term_data_form($vid, $tid, $ahah = FALSE, $print = TRUE, $msg = "", $is_error_msg = FALSE) {
  if (!$ahah) {
    drupal_goto('admin/content/taxonomy_manager/voc/' . $vid . '/' . $tid);
  }
  $GLOBALS['devel_shutdown'] = FALSE;

  //prevent devel queries footprint
  $params = $_GET;

  //actually we don not need do use the caching because the saving only happens through a AJAX callback

  //and it's a bit faster, cache loading, form building and cache saving needs some time else.

  /*$form_state = array('submitted' => FALSE);
    $form = form_get_cache($params['form_build_id'], $form_state);
    unset($form['term_data']);
    $form = form_builder($param['form_id'], $form, $form_state);*/
  $form_state = array();
  $term_form = taxonomy_manager_form_term_data($tid);
  $term_form['term_data']['save'] = array(
    '#type' => 'submit',
    '#value' => t('Save changes'),
    '#submit' => array(
      '',
    ),
    '#attributes' => array(
      'class' => 'taxonomy-manager-buttons save',
    ),
    '#ahah' => array(
      'path' => 'admin/content/taxonomy_manager/termdata/edit',
      'method' => 'replace',
      'event' => 'click',
      'wrapper' => 'taxonomy-term-data',
      'progress' => array(
        'type' => '',
      ),
    ),
    '#weight' => 20,
  );
  if ($msg != "") {
    $term_form['term_data']['msg'] = array(
      '#type' => 'markup',
      '#prefix' => '<div class="messages status">',
      '#suffix' => '</div>',
      '#value' => $msg,
      '#weight' => -20,
    );
    if ($is_error_msg) {
      $term_form['term_data']['msg']['#value'] = t("Error! Your last operation couldn't be performed because of following problem:") . " " . $msg;
      $term_form['term_data']['msg']['#prefix'] = '<div class="message error">';
    }
  }
  $form = $term_form;
  drupal_prepare_form('taxonomy_manager_form', $form, $form_state);
  $form = form_builder('taxonomy_manager_form', $form, $form_state);

  //form_set_cache($params['form_build_id'], $form, $form_state);
  $output = drupal_render($form['term_data']);
  if ($print) {
    print $output;
    exit;
  }
  return $output;
}