function og_get_group_audience_fields in Organic groups 7.2
Get the name of the group-audience type field.
Parameters
$entity_type: The entity type.
$bundle_name: The bundle name to be checked.
$group_type: Filter list to only include fields referencing a specific group type.
$group_bundle: Filter list to only include fields referencing a specific group bundle. Fields that do not specify any bundle restrictions at all are also included.
Return value
Array keyed with the field name and the field label as the value.
16 calls to og_get_group_audience_fields()
- og_complex_widget_after_build in includes/
og.field.inc - After build; Remove the "Add more" button.
- og_context_handler_url in og_context/
og_context.module - Context handler; Get groups from node create URL.
- og_entity_property_info in ./
og.module - Implements hook_entity_property_info().
- og_field_attach_form in ./
og.module - Implements hook_field_attach_form().
- og_field_create_instance in ./
og.module - Implements hook_field_create_instance().
1 string reference to 'og_get_group_audience_fields'
- og_invalidate_cache in ./
og.module - Invalidate cache.
File
- ./
og.module, line 2416 - Enable users to create and manage groups with roles and permissions.
Code
function og_get_group_audience_fields($entity_type = 'user', $bundle_name = 'user', $group_type = NULL, $group_bundle = NULL) {
$return =& drupal_static(__FUNCTION__, array());
$identifier = $entity_type . ':' . $bundle_name . ':' . $group_type . ':' . $group_bundle;
if (isset($return[$identifier])) {
return $return[$identifier];
}
$return[$identifier] = array();
foreach (field_info_instances($entity_type, $bundle_name) as $field_name => $instance) {
if (!og_is_group_audience_field($field_name)) {
continue;
}
$field_info = field_info_field($instance['field_name']);
if (isset($group_type) && $field_info['settings']['target_type'] != $group_type) {
continue;
}
if ($group_bundle && !empty($field_info['settings']['handler_settings']['target_bundles']) && !in_array($group_bundle, $field_info['settings']['handler_settings']['target_bundles'])) {
continue;
}
$return[$identifier][$field_name] = $instance['label'];
}
return $return[$identifier];
}