You are here

function PartyUserDataSetUIAttach::action_form_submit in Party 8.2

Same name and namespace in other branches
  1. 7 modules/party_user/includes/party_user.data_ui.inc \PartyUserDataSetUIAttach::action_form_submit()

Form submission for the action form.

Overrides PartyDefaultDataSetUIAttach::action_form_submit

File

modules/party_user/includes/party_user.data_ui.inc, line 53
Provides classes for UI actions on the user data set.

Class

PartyUserDataSetUIAttach
The 'attach' action: attach an existing entity.

Code

function action_form_submit($form, &$form_state) {

  // Get the original form parameters.
  list($party, $data_set, $action, $eid) = $form_state['build_info']['args'];

  // Attempt to load a user from the given input.
  $account = user_load_by_name($form_state['values']['user']);
  if ($account->uid != 0) {

    // Attach the user entity to the party.
    $data_set_controller = party_get_crm_controller($party, $data_set['set_name']);
    $data_set_controller
      ->attachEntity($account);
    $data_set_controller
      ->save();
  }
}