0

A vocabulary has an additional field field_information attached. In a view i just want to render this information field exclusively (without term name etc). In my views-view-field.tpl.php I did a dpm($field), but I can't figure out how to get to the value of field_information. Unfortunately due to my setup I can't use the module taxonomy_field_formatter, I'll have to do it manually.

0

Puh, finally I found a way. This is my template file views-view-field.tpl.php (instead of a custom field I used the description field, but that doesn't matter in this case):

<?php
if (isset($row->_field_data['nid']['entity']->field_myfiled['und'][0]['tid'])) {
  $tid = $row->_field_data['nid']['entity']->field_myfield['und'][0]['tid'];
  $term = taxonomy_term_load($tid);
  $output = $term->description_field['und'][0]['value'];
} else {
  $output = $output;
};
?>

<?php print $output; ?>

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.