You are here

function hosting_client_user_form in Hostmaster (Aegir) 6

Add items to the user forms when editing or registering.

See also

hosting_client_user()

1 call to hosting_client_user_form()
hosting_client_user in modules/hosting/client/hosting_client.access.inc
Implements hook_user().

File

modules/hosting/client/hosting_client.access.inc, line 73
Control client node access.

Code

function hosting_client_user_form($edit, $user, $category) {
  $clients = array();
  if ($user->client_id) {
    foreach ($user->client_id as $client => $type) {
      $clients[$client] = '';
      $fields[$category]['name'][$client] = array(
        '#type' => 'markup',
        '#value' => _hosting_node_link($client),
      );
    }
  }
  if (user_access('edit client users')) {
    $fields[$category]['clients'] = array(
      '#type' => 'checkboxes',
      '#options' => $clients,
    );
  }
  $fields[$category]['header'] = array(
    '#type' => 'value',
    '#value' => array(
      array(
        'data' => t('Accessible clients'),
      ),
      array(
        'data' => t('Remove'),
      ),
    ),
  );
  if (user_access('edit client users')) {
    $fields[$category]['hosting_client'] = array(
      '#type' => 'textfield',
      '#title' => t('Associate a client to this user'),
      '#weight' => 2,
      '#autocomplete_path' => 'hosting_client/autocomplete/client',
      '#description' => t('This field allows you to associate an existing client to a user.
                             It does not create a new client, but allows this user
                             to manage sites belonging to the given client.'),
    );
  }
  $fields[$category]['#theme'] = 'hosting_client_user_form';
  return $fields;
}