You are here

function deploy_server_form in Deploy - Content Staging 6

Same name and namespace in other branches
  1. 5 deploy.module \deploy_server_form()

Display add/edit deployment server form.

Parameters

$form_state: FAPI form state

$sid: Unique identifier for the server we're editing, or NULL if creating a new server.

Return value

FAPI form definition

See also

deploy_server_form_validate()

deploy_server_form_submit()

1 string reference to 'deploy_server_form'
deploy_menu in ./deploy.module
Implementation of hook_menu().

File

./deploy.servers.admin.inc, line 47
Page handlers for deploy server admin.

Code

function deploy_server_form($form_state, $sid = NULL) {
  $server = NULL;

  // If we got a SID, get the plan's details.
  if (!empty($sid)) {
    $server = deploy_get_server($sid);
    $form['sid'] = array(
      '#type' => 'hidden',
      '#default_value' => $sid,
    );
  }
  $form['description'] = array(
    '#title' => t('Name'),
    '#type' => 'textfield',
    '#size' => 50,
    '#maxlength' => 100,
    '#required' => TRUE,
    '#default_value' => $server['description'],
    '#description' => t('Description of this server.'),
  );
  $form['url'] = array(
    '#title' => t('URL'),
    '#type' => 'textfield',
    '#size' => 50,
    '#maxlength' => 100,
    '#required' => TRUE,
    '#default_value' => $server['url'],
    '#description' => t('Domain name and path to xmlrpc service.'),
  );
  $auth_options = array(
    '' => t('-- Select a type'),
  );
  $auth_types = deploy_get_auth_types();
  foreach ($auth_types as $key => $type) {
    $auth_options[$key] = $type['title'];
  }
  $form['auth_type'] = array(
    '#title' => t('Authentication type'),
    '#description' => t('Select which authentication type to be used when deploying to this specific server.'),
    '#type' => 'select',
    '#required' => TRUE,
    '#options' => $auth_options,
    '#default_value' => $server['auth_type'],
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save Deployment Server'),
  );
  return $form;
}