You are here

function _uc_coupon_list_terms in Ubercart Discount Coupons 7.3

Same name and namespace in other branches
  1. 7.2 uc_coupon.module \_uc_coupon_list_terms()

Lists all taxonomy terms contained in 'taxonomy_term_reference' fields for a given node.

Parameters

$node: The node whose terms should be listed;

Return value

An array of any taxonomy term id's.

1 call to _uc_coupon_list_terms()
uc_coupon_calculate_discounts in ./uc_coupon.module
Find items that a coupon will apply to and calculate the discounts.

File

./uc_coupon.module, line 1103
Provides discount codes and gift certificates for Ubercart.

Code

function _uc_coupon_list_terms($node) {
  $terms = array();
  foreach (array_keys(field_info_instances('node', $node->type)) as $field_name) {
    $field_info = field_info_field($field_name);
    if ($field_info['type'] == 'taxonomy_term_reference') {
      if ($field_values = field_get_items('node', $node, $field_name)) {
        foreach ($field_values as $field_value) {
          $terms[] = $field_value['tid'];
        }
      }
    }
  }
  return $terms;
}