function domain_form in Domain Access 6.2
Same name and namespace in other branches
- 7.3 domain.admin.inc \domain_form()
- 7.2 domain.admin.inc \domain_form()
FormsAPI for editing a domain record
Parameters
$form_state: The current form state, passed by FormsAPI.
$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.
2 string references to 'domain_form'
- domain_menu in ./
domain.module - Implement hook_menu()
- domain_user_user in domain_user/
domain_user.module - Implement hook_user()
File
- ./
domain.admin.inc, line 424 - Administration functions for the domain module.
Code
function domain_form($form_state, $domain = array(), $arguments = array()) {
global $_domain;
// This action should be performed from the primary domain unless overridden.
if (!isset($arguments['ignore_domain_status_check'])) {
domain_check_primary();
if (empty($_POST) && !empty($domain)) {
domain_check_response($domain);
}
}
// Ensure indexes are set.
foreach ($_domain as $key => $value) {
if (!isset($domain[$key])) {
$domain[$key] = NULL;
}
}
$form = array();
$form['#domain'] = $domain;
// 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('Domain record'),
'#collapsible' => TRUE,
);
$form['domain_id'] = array(
'#type' => 'value',
'#value' => $domain['domain_id'],
);
if (!variable_get('domain_allow_non_ascii', FALSE)) {
$description = t('Must contain only dots, lowercase alphanumeric characters, dashes and a colon (if using alternative ports).');
}
else {
$description = t('Must contain only dots, lowercase alphanumeric and ASCII characters, dashes and a colon (if using alternative ports).');
}
$form['domain']['subdomain'] = array(
'#type' => 'textfield',
'#title' => t('Domain'),
'#size' => 40,
'#maxlength' => 80,
'#required' => TRUE,
'#default_value' => $domain['subdomain'],
'#description' => t('The allowed domain, using the full <em>path.example.com</em> format.') . '<br />' . t('Leave off the http:// and the trailing slash and do not include any paths.') . '<br />' . $description,
);
$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' => !empty($domain['scheme']) ? $domain['scheme'] : 'http',
'#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' => isset($domain['valid']) ? $domain['valid'] : 1,
'#description' => t('Must be set to "Active" for users to navigate to this domain.'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save domain record'),
);
$form['#validate'][] = 'domain_form_validate';
$form['#redirect'] = array(
'admin/build/domain/view',
);
return $form;
}