You are here

function domain_edit_form in Domain Access 5

FormsAPI for editing a domain record

Parameters

$domain: An array containing the record from the {domain} table.

$arguments: An array of additional hidden key/value pairs to pass to the form. Used by child modules to control behaviors. Currently supported arguments are: 'user_submitted' => TRUE Indicates that a form should not process administrative messages and paths upon form submit. Used by the Domain User module.

1 string reference to 'domain_edit_form'
domain_edit in ./domain_admin.inc
Edit an existing domain record

File

./domain_admin.inc, line 527
Administration functions for the domain module.

Code

function domain_edit_form($domain, $arguments = array()) {
  if (empty($_POST)) {
    domain_check_response($domain);
  }
  $form = array();

  // The $arguments arrray allows other modules to pass values to change the bahavior
  // of submit and validate functions.
  if (!empty($arguments)) {
    $form['domain_arguments'] = array(
      '#type' => 'value',
      '#value' => $arguments,
    );
  }
  $form['domain'] = array(
    '#type' => 'fieldset',
    '#title' => t('Edit domain record'),
    '#collapsible' => TRUE,
  );
  $form['domain_id'] = array(
    '#type' => 'value',
    '#value' => $domain['domain_id'],
  );
  $form['domain']['subdomain'] = array(
    '#type' => 'textfield',
    '#title' => t('Domain'),
    '#size' => 40,
    '#maxlength' => 80,
    '#required' => TRUE,
    '#default_value' => $domain['subdomain'],
    '#description' => t('The allowed subdomain, using the full <em>path.example.com</em> format.  Can only contain lower-case alphanumeric characters.  Leave off the http:// and the trailing slash.'),
  );
  $form['domain']['sitename'] = array(
    '#type' => 'textfield',
    '#title' => t('Site name'),
    '#size' => 40,
    '#maxlength' => 80,
    '#required' => TRUE,
    '#default_value' => $domain['sitename'],
    '#description' => t('The human-readable name of this domain.'),
  );
  $form['domain']['scheme'] = array(
    '#type' => 'radios',
    '#title' => t('Domain URL scheme'),
    '#required' => TRUE,
    '#options' => array(
      'http' => 'http://',
      'https' => 'https://',
    ),
    '#default_value' => $domain['scheme'],
    '#description' => t('The URL scheme for accessing this domain.'),
  );
  $form['domain']['valid'] = array(
    '#type' => 'radios',
    '#title' => t('Domain status'),
    '#required' => TRUE,
    '#options' => array(
      1 => t('Active'),
      0 => t('Inactive'),
    ),
    '#default_value' => $domain['valid'],
    '#description' => t('Must be set to "Active" for users to navigate to this domain.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save domain record'),
  );
  return $form;
}