You are here

class PartyUserDataSetUIAdd in Party 7

Same name and namespace in other branches
  1. 8.2 modules/party_user/includes/party_user.data_ui.inc \PartyUserDataSetUIAdd

The 'add' action: add a new user.

Hierarchy

Expanded class hierarchy of PartyUserDataSetUIAdd

1 string reference to 'PartyUserDataSetUIAdd'
party_user_party_data_set_info in modules/party_user/party_user.party_info.inc
Implements hook_party_data_set_info()

File

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

View source
class PartyUserDataSetUIAdd extends PartyDefaultDataSetUIAdd {

  /**
   * Provides the action form for attaching an existing user.
   *
   * @param $party
   *   A loaded party object.
   * @param $data_set
   *   A loaded data set.
   *   We don't actually need this loaded, but we need a menu loader to convert
   *   the path-style string to the machine name, and a menu loader that doesn't
   *   load would be weird too.
   * @param $eid
   *   The id of the entity, if relevant to this action.
   */
  function action_form($form, &$form_state, $party, $data_set, $eid = NULL) {
    module_load_include('inc', 'user', 'user.pages');
    $form = user_register_form($form, $form_state);
    return $form;
  }
  function action_form_validate($form, &$form_state) {
  }
  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 = $form_state['user'];
    if ($account->uid != 0) {

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

}

Members

Namesort descending Modifiers Type Description Overrides
PartyDefaultDataSetUIAdd::get_page_title function The page title for the action form. Overrides PartyDataSetActionInterface::get_page_title
PartyUserDataSetUIAdd::action_form function Provides the action form for attaching an existing user. Overrides PartyDefaultDataSetUIAdd::action_form
PartyUserDataSetUIAdd::action_form_submit function Form submission for the action form. Overrides PartyDefaultDataSetUIAdd::action_form_submit
PartyUserDataSetUIAdd::action_form_validate function Form validation for the action form. Overrides PartyDefaultDataSetUIAdd::action_form_validate