Im trying to create a computed value field using the the computed_field module. I trying to do something like http://drupal.org/node/792922 but that example is for drupal 6. Can someone point me in the right direction of how to do this with drupal 7?
If you have taxonomy id, I'd suggest to do this:
$term = taxonomy_load_term($tid); $node->your_field_name[your_language_specifier][your_value_index]['value'] = $term->name;
if you don't have taxonomy term id you can get it like so:
$field_name = 'term'; //or what ever your field is named $entity_id = 4;//or what ever your entity id is $query = db_select("field_data_field_" . $field_name, $field_name); $query->addField($field_name, "field_" . $field_name . "_tid", "tid"); $query->condition("entity_id", $entity_id, "="); $result = $query->execute()->fetchAssoc(); $tid = $result['tid'];