Wednesday, June 6, 2012

Taxonomy add edit form simplified for client

I wanted to clean the taxonomy form for our client.

So i created one custom module. and here is my module file code.

function capo_form_alter(&$form, &$form_state, $form_id){
  switch ($form_id) {
    case 'taxonomy_form_term':
      $form['name']=$form['identification']['name'];
      $form['parent']=$form['advanced']['parent'];
      $form['parent']['#weight']=1;
      $form['submit']['#weight']=10000;
      if($form['delete'])
      $form['delete']['#weight']=10001;
      $form['weight']=$form['advanced']['weight'];
      $form['weight']['#access']=FALSE;
      $form['parent']['#multiple']=0;
      $form['parent']['#size']=1;

      unset ($form['identification']);
      unset ($form['advanced']);
      //dsm($form);
      break;

    default:
      break;
  }
}

No comments: