You are here

function hosting_signup_form in Hostmaster (Aegir) 6

Form definition

This is a mixture of the client form and node form, and in the future we will be able to configure which forms we want to be present.

1 string reference to 'hosting_signup_form'
hosting_signup_menu in modules/hosting/signup/hosting_signup.module
Implementation of hook_menu

File

modules/hosting/signup/hosting_signup.module, line 49
Provides a signup form that can be run on remote sites

Code

function hosting_signup_form() {
  global $user;
  if (!variable_get('hosting_client_register_user', FALSE) && !$user->uid) {
    drupal_set_message(t("Please login first. We have no way of guessing your email and this site is configured not to register new users. You will not receive the login link for your new site. This is probably a bad configuration."));
  }
  $node = new stdClass();
  $form['site'] = hosting_site_form($node);
  unset($form['site']['client']);
  $state = array();
  foreach (module_implements('form_alter') as $module) {
    $function = $module . '_form_alter';
    $function($form['site'], $state, 'site_node_form');
  }
  unset($form['site']['info']['client']);
  $form['client'] = hosting_client_form($node);
  foreach (module_implements('form_alter') as $module) {
    $function = $module . '_form_alter';
    $function($form['client'], $state, 'client_node_form');
  }
  $form['client']['client_name'] = $form['client']['title'];
  if (variable_get('hosting_client_register_user', FALSE) && !$user->uid) {
    $form['client']['email']['#required'] = TRUE;
    $form['client']['email_confirm']['#required'] = TRUE;
  }
  unset($form['client']['title']);
  $form['new_client'] = array(
    '#type' => 'value',
    '#value' => TRUE,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t("Sign up"),
  );
  return $form;
}