Sorry for this newbie question.
I couldn't find out how to so please forgive me to ask here..
How can I use vertical tabs for taxonomy selection list in node edit page?
All the fields are now in separate vertical tabs but only the taxonomy list is out of there and stays on the top of node edit page.
I saw some issues with like hierarchical select module but I don't even find how to include it into Vertical Tabs.

Comments

doublejosh’s picture

I was able to do this, but not if the node type is a product.

chinita7’s picture

Alright. My node type is actually a product. Thant's way it doesn't work.. Thanks anyway.

doublejosh’s picture

I was wrong.
It's working fine on the product type now. The issue seems to be the "Minimum number of tabified fieldsets to show vertical tabs:" which is defaulted to 3. Even though it doesn't quite state that in that setting description, it seems that you have to have at least that number of vocabs on the node type to get the vertical tab.

Does this do it for you?

Regardless of this "solution," you still can't explicitly put just one vocab in without dealing with this setting, which is possible with the more flexible field system in 7. You can use Content Taxonomy to gain this kind of control.

chinita7’s picture

Status: Active » Needs review

Thanks for letting me know. I actually have only two vocabularies on D6. Content Taxonomy might be a good idea I'll have a look.

Bartezz’s picture

Create a custom module and use the code below

function custommodule_form_alter(&$form, &$form_state, $form_id) {
	if (is_int(key((array)$form['taxonomy']))) {
		$form['taxonomy']['#title'] = t('Categories');
		$form['taxonomy']['#type'] = 'fieldset';
	}
}

Cheers

doublejosh’s picture

Excellent solution.
Looks like a great work around for folks with just one big vocab that needs a tab.
Other folks can just set their number appropriately.

Personally pick the forms slightly differently.

function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
  // If all node forms.
  // if (substr($form_id,-10) == '_node_form') {
  // Or just specific node forms.
  switch ($form_id) {
    case 'page_node_form' :
    case 'article_node_form' :
    case 'mytype_node_form' :
      $form['taxonomy']['#title'] = t('Categories');
      $form['taxonomy']['#type'] = 'fieldset';
      break;
  }
}
Bartezz’s picture

@doublejosh; Also use a check that a vocabulary is actually enabled for the content-type! Problem is that some users might not have a permission. Or maybe later in the project a vocabulary is removed from a content-type. Your code would leave users with an empty fieldset in the node edit page!

<?php
function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
  // If all node forms.
  // if (substr($form_id,-10) == '_node_form') {
  // Or just specific node forms.
  switch ($form_id) {
    case 'page_node_form' :
    case 'article_node_form' :
    case 'mytype_node_form' :
      if (is_int(key((array)$form['taxonomy']))) {
        $form['taxonomy']['#title'] = t('Categories');
        $form['taxonomy']['#type'] = 'fieldset';
      }
    break;
  }
}
?>

I'm using is_int(key((array)$form['taxonomy'])) as the $form['taxonomy'] array might exist even if there is no vocabulary active for that particular content-type, the array will contain keys/values like #tree and such. If there IS a vocabulary active then $form['taxonomy'] will contain numeric keys where the numeric key is the VID, hence my is_int check :)

Cheers

doublejosh’s picture

Gotcha. Awesome. Thorough :)