class PartyUserDataSetUIAdd in Party 8.2
Same name and namespace in other branches
- 7 modules/party_user/includes/party_user.data_ui.inc \PartyUserDataSetUIAdd
The 'add' action: add a new user.
Hierarchy
- class \PartyDefaultDataSetUIAdd implements PartyDataSetActionInterface
- class \PartyUserDataSetUIAdd
Expanded class hierarchy of PartyUserDataSetUIAdd
1 string reference to 'PartyUserDataSetUIAdd'
- party_user_party_data_set_info in modules/
party_user/ party_user.module - 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.
$data_set_controller = party_get_crm_controller($party, $data_set['set_name']);
$data_set_controller
->attachEntity($account);
$data_set_controller
->save();
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PartyDefaultDataSetUIAdd:: |
function |
The page title for the action form. Overrides PartyDataSetActionInterface:: |
||
PartyUserDataSetUIAdd:: |
function |
Provides the action form for attaching an existing user. Overrides PartyDefaultDataSetUIAdd:: |
||
PartyUserDataSetUIAdd:: |
function |
Form submission for the action form. Overrides PartyDefaultDataSetUIAdd:: |
||
PartyUserDataSetUIAdd:: |
function |
Form validation for the action form. Overrides PartyDefaultDataSetUIAdd:: |