views:

16

answers:

0

In my module, I am trying to get the all names of terms that comma-separated in the field of taxonomy ( for create/edit node ). For example: a,b,c,d :

<?php

function mymodule_form_alter(&$form, $form_state, $form_id) {

   if($form_id == 'story_node_form') {

   $form['#submit'][] = 'mymodule_form_mysubmit';

   }

}

function mymodule_form_mysubmit($form, &$form_state) {

$vid = 6;

$names = $form_state['values']['taxonomy']['tags'][$vid]['# textfield']; // $vid - Vocabulary ID

dsm($names); // Debugging by Devel. Shows only name "a" in $names

}

Module "Devel" shows the presence of only one first name.

How can I get all the names of terms?

Thanks

related questions