1

I have a custom module in place to get details of a node after the node has been submitted. I am trying to collect all the taxonomy terms associated with that node. The taxonomy terms are selected by multiple check boxes on the node creation page.

$items = $form['field_content_type_list']['und']['#value'];

and then go through them in a for loop:

foreach ($items as $item)

The problem is that $item is the index in the taxonomy list rather than the name of the object itself as a string.

Is there a way of getting the string value rather than the index of the term?

Thanks

  • 1
  • When I want to echo($term) it's null... How do I echo the value? – Jeevan Thandi Jan 12 '14 at 15:22
  • Are you sure this field is a taxonomy reference, not a list? The name "field_content_type_list" is suspicious. In your follow-up comment, you do not say how $term is defined, so I am just guessing that you have defined it. If so, then install the Devel module and use dsm($term); instead of `echo. – benjifisher Jan 12 '14 at 22:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.