You are here

function og_vocab_get_og_vocab_fields in OG Vocabulary 7

Get the name of the group-audience type field.

Parameters

$entity_type: The entity type.

$bundle_name: The bundle name to be checked.

Return value

Array keyed with the field name and the field label as the value.

See also

og_get_group_audience_fields()

5 calls to og_vocab_get_og_vocab_fields()
OgVocab::save in includes/og_vocab.og_vocab.inc
Overrides Entity::save().
og_vocab_element_after_build in includes/og_vocab.og_vocab.inc
After build; Remove the "Add more" button.
og_vocab_element_validate in includes/og_vocab.og_vocab.inc
Validate handler; Re-build the submited values.
og_vocab_form_taxonomy_form_vocabulary_alter in ./og_vocab.module
Implements hook_form_FORM-ID_alter().
og_vocab_load_og_vocab in ./og_vocab.module
Get OG vocabulary settings by vocabulary ID.

File

./og_vocab.module, line 403
Give each group its own system controlled vocabularies.

Code

function og_vocab_get_og_vocab_fields($entity_type, $bundle_name) {
  $return =& drupal_static(__FUNCTION__, array());
  $identifier = $entity_type . ':' . $bundle_name;
  if (isset($return[$identifier])) {
    return $return[$identifier];
  }
  $return[$identifier] = array();

  // field_info_instances() doesn't give the field type, so we have to use
  // field_info_fields().
  foreach (field_info_instances($entity_type, $bundle_name) as $field_name => $instance) {
    if (!og_vocab_is_og_vocab_field($entity_type, $field_name, $bundle_name)) {
      continue;
    }
    $return[$identifier][$field_name] = $instance['label'];
  }
  return $return[$identifier];
}