You are here

function hosting_platform_form in Hosting 5

Same name and namespace in other branches
  1. 6.2 platform/hosting_platform.module \hosting_platform_form()
  2. 7.4 platform/hosting_platform.module \hosting_platform_form()
  3. 7.3 platform/hosting_platform.module \hosting_platform_form()

Implementation of hook_form().

File

platform/hosting_platform.module, line 81
Platform node type definition

Code

function hosting_platform_form(&$node) {
  $type = node_get_types('type', $node);
  $form['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Name'),
    '#required' => TRUE,
    '#description' => t('Choose a descriptive name for your platform. You very likely want this to be something like "Drupal 6.10".'),
    '#size' => 40,
    '#default_value' => $node->title,
    '#maxlength' => 255,
  );
  $form['publish_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Publish path'),
    '#required' => TRUE,
    '#description' => t('The path on the filesystem where the sites will be hosted. This needs to be created manually and initialized before your platform works properly. Use the following shell commands:<pre>%commands</pre>', array(
      '%commands' => "cd /var/aegir\n./drush/drush.php dl drupal\n",
    )),
    '#size' => 40,
    '#default_value' => $node->publish_path,
    '#maxlength' => 255,
  );
  $servers = _hosting_get_web_servers();
  if (sizeof($servers) > 1) {
    $form['web_server'] = array(
      '#type' => 'radios',
      '#title' => t('Web server'),
      '#description' => t('The web server the sites will be hosted on.'),
      '#options' => $servers,
      '#default_value' => $node->web_server ? $node->web_server : HOSTING_DEFAULT_WEB_SERVER,
    );
  }
  else {
    $form['web_server'] = array(
      '#type' => 'hidden',
      '#value' => key($servers),
    );
  }
  if ($node->nid != HOSTING_DEFAULT_PLATFORM) {
    $form['default_platform'] = array(
      '#type' => 'checkbox',
      '#return_value' => 1,
      '#title' => t('Make default platform for new sites'),
    );
  }
  else {
    $form['default_platform'] = array(
      '#type' => 'value',
      '#value' => 1,
    );
  }
  return $form;
}