You are here

function hostmaster_task_dbserver in Hostmaster (Aegir) 5.x

Database configuration form

Inherits the db_server_node_form, and shifts some things around. Perhaps those changes need to go in upstream?

File

./hostmaster.forms.inc, line 139

Code

function hostmaster_task_dbserver() {
  drupal_set_title(st('Configure your database server'));

  /* TODO drupal_retrieve_form() now accepts a form_state parameter. */
  $form = node_form($form_state, node_load(HOSTING_OWN_DB_SERVER));
  _hostmaster_clean_node_form($form);
  $own_link = _hosting_node_link(HOSTING_OWN_DB_SERVER);
  $form['introduction']['#weight'] = -9;
  $form['introduction']['#value'] = t('<p>You need at least one fully functional database server to be able to manage sites.
       Luckily, if you can read this, you are already most of the way there. <strong>If the user you specified when first configuring the Drupal can create databases, you probably do not need to change anything here.</strong></p>
        <p>This configuration form is actually the !edit_page for the !own_server database server node.
        It has however been heavily annotated and slightly simplified for this installation wizard. And while
        the wizard can be run multiple times, it won\'t be able to edit any database servers other than the database
        this site is running on.</p>', array(
    '!own_server' => $own_link,
    '!edit_page' => l(t("edit page"), 'node/' . HOSTING_OWN_DB_SERVER . '/edit'),
  ));
  $form['title']['#type'] = 'value';
  $form['db_details'] = array(
    '#type' => 'fieldset',
    '#collapsed' => false,
    '#title' => t('Database account details'),
  );
  $form['db_details']['help'] = array(
    '#type' => 'requirement_help',
    '#requirement' => 'mysql_user',
    '#configuration' => HOSTING_HELP_COLLAPSED,
    '#summary' => HOSTING_HELP_COLLAPSED,
  );
  $form['db_details']['db_user'] = $form['db_user'];
  unset($form['db_user']);
  $form['db_details']['db_passwd'] = $form['db_passwd'];
  unset($form['db_passwd']);
  return hostmaster_form($form);
}