You are here

function og_field_attach_form in Organic groups 7.2

Same name and namespace in other branches
  1. 7 og.field.inc \og_field_attach_form()

Implements hook_field_attach_form().

File

./og.module, line 717
Enable users to create and manage groups with roles and permissions.

Code

function og_field_attach_form($entity_type, $entity, &$form, &$form_state, $langcode) {
  list(, , $bundle) = entity_extract_ids($entity_type, $entity);
  if (!isset($form['#entity'])) {
    $form['#entity'] = $entity;
  }
  if (og_get_group_audience_fields($entity_type, $bundle)) {
    $form['#validate'][] = 'og_form_group_reference_validate';
  }
  if ($entity_type == 'user' || !og_is_group_type($entity_type, $bundle)) {
    return;
  }
  $form['#validate'][] = 'og_form_group_manager_validate';
}