2

I have taxonomy term reference field which are displayed as checkbox.
Each taxonomy term has two fields
1. description and other
2. price
I want the description and price field to be displayed alongside the title in field(term refrence).
How can I achieve ut?

1

The function taxonomy_term_view is for displaying a taxonomy term as a rendered entity. If not specified explicitly with an extra parameter, it uses the view mode full, which displays all fields, one after the other. But you can adapt that in the admin backend, and also define other view modes. So in your case, the code would be like:

$term = taxonomy_term_load($entity->field_term_reference);
$term_view = taxonomy_term_view($term);

This generates a Drupal render array. In case you want to use this in a theme context, add one more line:

drupal_render($term_view);

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.