taxonomy_admin

Versions
4.6
taxonomy_admin()

Menu callback; dispatches to the proper taxonomy administration function.

Code

modules/taxonomy.module, line 976

<?php
function taxonomy_admin() {
  $op = $_POST['op'];
  $edit = $_POST['edit'];

  if (empty($op)) {
    $op = arg(2);
  }

  switch ($op) {
    case 'add':
      if (arg(3) == 'vocabulary') {
        $output = taxonomy_form_vocabulary();
      }
      else if (arg(3) == 'term') {
        $output = taxonomy_form_term();
      }
      break;
    case 'edit':
      if (arg(3) == 'vocabulary') {
        $output = taxonomy_form_vocabulary(object2array(taxonomy_get_vocabulary(arg(4))));
      }
      else if (arg(3) == 'term') {
        $output = taxonomy_form_term(object2array(taxonomy_get_term(arg(4))));
      }
      break;
    case 'preview':
      $output = taxonomy_form(arg(4));
      break;
    case t('Delete'):
      if (!$edit['confirm']) {
        if (arg(3) == 'vocabulary') {
          $output = _taxonomy_confirm_del_vocabulary($edit['vid']);
        }
        else {
          $output = _taxonomy_confirm_del_term($edit['tid']);
        }
        break;
      }
      else {
        $edit['name'] = 0;
        // fall through:
      }
    case t('Submit'):
      if (arg(3) == 'vocabulary') {
        taxonomy_save_vocabulary($edit);
      }
      else {
        taxonomy_save_term($edit);
      }
      drupal_goto('admin/taxonomy');
    default:
      $output = taxonomy_overview();
  }

  print theme('page', $output);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.