1
votes

I'm trying to make form to post advert in newspaper and want to let user select style of future post and show how it will be printed. So i create taxonomy vocab. "style" with name, sample image and max. characters to this type. Next i'm creating field taxonomy term relation in advert content type.

Now i need to show in adding form not just radios or select with titles but title, sample image and other fields from taxonomy.

I think i need to use hook_form_alter so i use mymodule_form_ad_node_form_alter(&$form, &$form_state, $form_id) but what i can't understand is how in drupal way i can get rest of taxonomy fields? In $form array is only tids and titles.

Is it possible not to query DB again but setup existing query to retrieve all fields i need?
Also how i can insert that additional information into form? Is it other way than #suffix #prefix on radios?

1

1 Answers

1
votes

If this is a Drupal 7 then you can use an Entity Reference field along with the Entity Reference view widget instead of a term reference field. That will allow you to specify a view to use to populate the field options, and you can create an entity reference view that display the additional taxonomy term fields you want to display.