function taxonomy_csv_term_get_field_values in Taxonomy CSV import/export 7.4
Return an array of values of a field of a given term id or object.
@todo To be removed by using of field api.
Values can be names or ids depending on field type (text or term reference).
Parameters
$term_tid: Term object or term id from which to get values. Use of object is quicker.
$field_name: Field to get.
$langcode: (Optional) Language code to use.
Return value
Result array of items.
5 calls to taxonomy_csv_term_get_field_values()
- taxonomy_csv_term_get_field_names in ./
taxonomy_csv.term.api.inc - Return an array of all names of a term reference field of a given term ID.
- taxonomy_csv_term_get_field_terms in ./
taxonomy_csv.term.api.inc - Return an array of all term objects of a reference field of a given term ID.
- taxonomy_csv_term_get_relations_tids in ./
taxonomy_csv.term.api.inc - Return an array of all related term ids of a given term id or object. Wrapper of taxonomy_csv_term_get_field_values.
- taxonomy_csv_term_get_synonyms in ./
taxonomy_csv.term.api.inc - Return an array of all synonyms of a given term id or object.
- _taxonomy_csv_term_format_internal in ./
taxonomy_csv.term.api.inc - Format a regular term for internal purpose (synonyms and relations).
File
- ./
taxonomy_csv.term.api.inc, line 164 - Find, get and set full or detail term items.
Code
function taxonomy_csv_term_get_field_values($term_tid, $field_name, $langcode = 'und') {
$items = array();
$term = is_object($term_tid) ? $term_tid : taxonomy_term_load($term_tid);
$value = $field_name == 'taxonomy_relation' ? 'tid' : 'value';
if (isset($term->{$field_name}[$langcode])) {
foreach ($term->{$field_name}[$langcode] as $delta) {
$items[] = $delta[$value];
}
}
return $items;
}