You are here

function synonyms_synonyms_fields in Synonyms 7

Return array of field names that are sources of synonyms.

Return array of field names that are currently have enabled the synonyms behavior in the supplied vocabulary. This function is deprecated and shortly will be removed from the code. All clients of this function are encourage to use synonyms_behavior_get() function, which provides a richer set of functionality than this one.

Parameters

object $vocabulary: Fully loaded taxonomy vocabulary object

Return value

array Array of field names

File

./synonyms.module, line 868
Provide synonyms feature for Drupal entities.

Code

function synonyms_synonyms_fields($vocabulary) {

  // TODO: remove this ugly function as soon as possible. It has got hacky since
  // now not only fields may be providers of synonyms.
  if (!module_exists('taxonomy')) {
    return array();
  }
  $fields = array();
  $bundle = field_extract_bundle('taxonomy_term', $vocabulary);
  $behavior_implementations = synonyms_behavior_get_all_enabled('taxonomy_term', $bundle);
  foreach ($behavior_implementations as $v) {
    $field_name = synonyms_provider_field_field_name($v['provider']);
    if (field_info_field($field_name)) {
      $fields[] = $field_name;
    }
  }
  return $fields;
}