You are here

function hosting_signup_form in Hosting 7.4

Same name and namespace in other branches
  1. 5 signup/hosting_signup.module \hosting_signup_form()
  2. 6.2 signup/hosting_signup.module \hosting_signup_form()
  3. 7.3 signup/hosting_signup.module \hosting_signup_form()

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.

2 string references to 'hosting_signup_form'
hosting_client_validate in client/hosting_client.module
Implements hook_validate().
hosting_signup_menu in signup/hosting_signup.module
Implements hook_menu().

File

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

Code

function hosting_signup_form($form, &$form_state) {
  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, $form_state);
  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, $form_state);
  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;
}