function group_membership_actions_form in Group 7
Generate the membership actions form for a group.
1 string reference to 'group_membership_actions_form'
- group_entity_view in ./
group.entity.inc - Implements hook_entity_view().
File
- forms/
group.membership_actions.inc, line 13 - Group membership actions form generator.
Code
function group_membership_actions_form($form, &$form_state, Group $group, $account) {
// Make sure this file is available throughout the entire form lifetime.
form_load_include($form_state, 'inc', 'group', 'forms/group.membership_actions');
// Retrieve the membership (if it exists).
$group_membership = $group
->getMember($account->uid);
foreach (group_membership_action_info() as $action => $info) {
if (isset($info['access callback']) && !call_user_func($info['access callback'], $group, $account, $group_membership)) {
continue;
}
$form[$action] = array(
'#type' => 'submit',
'#name' => "op_{$action}",
'#value' => $info['label'],
);
}
return $form;
}