You are here

function group_membership_join_form_builder in Group 7

Form builder for the "Join group" and "Request membership" forms.

See also

GroupMembership::hook_forms()

1 string reference to 'group_membership_join_form_builder'
GroupMembershipUIController::hook_menu in classes/group_membership.ui_controller.inc
Provides definitions for implementing hook_menu().

File

forms/group_membership.inc, line 100
Group membership editing UI.

Code

function group_membership_join_form_builder(Group $group, $account, $form_id) {

  // Build an empty GroupMembership.
  $values = array(
    'gid' => $group->gid,
    'uid' => $account->uid,
  );
  $group_membership = entity_create('group_membership', $values);

  // Create our own form state and build the form.
  $form_state['entity_type'] = 'group_membership';
  $form_state['group_membership'] = $group_membership;
  $form_state['redirect'] = "group/{$group->gid}";
  $form_state['build_info']['args'] = array(
    $group_membership,
    'add',
    'group_membership',
  );
  return drupal_build_form($form_id, $form_state);
}