function domain_configure_form in Domain Access 6.2
Same name and namespace in other branches
- 5 domain_admin.inc \domain_configure_form()
- 7.3 domain.admin.inc \domain_configure_form()
- 7.2 domain.admin.inc \domain_configure_form()
FormsAPI for configuring the domain module.
2 string references to 'domain_configure_form'
- domain_configure in ./
domain.admin.inc - Module settings and behaviors.
- domain_settings_add_element in domain_settings/
domain_settings.module - Helper function to test if a form has to display the domain-specific settings, based on 'domain_settings' settings the user defined.
File
- ./
domain.admin.inc, line 111 - Administration functions for the domain module.
Code
function domain_configure_form($form_state, $user_submitted = FALSE) {
$root = variable_get('domain_root', '');
if (empty($root)) {
domain_set_primary_domain();
}
$form = array();
$form['domain'] = array(
'#type' => 'fieldset',
'#title' => t('Default domain settings'),
'#collapsible' => TRUE,
);
$sitename = variable_get('site_name', 'Drupal');
$form['domain']['domain_root'] = array(
'#type' => 'textfield',
'#title' => t('Primary domain name'),
'#size' => 40,
'#maxlength' => 80,
'#required' => TRUE,
'#default_value' => variable_get('domain_root', ''),
'#description' => t('The primary domain for your site. Typically <em>example.com</em> or <em>www.example.com</em>. Do not use http or slashes.
<br />This domain will be used as the default URL for your site.
<br />If an invalid domain is requested, users will be sent next available domain or to the primary domain.'),
);
$form['domain']['domain_sitename'] = array(
'#type' => 'textfield',
'#title' => t('Site name'),
'#size' => 40,
'#maxlength' => 80,
'#required' => TRUE,
'#default_value' => variable_get('domain_sitename', $sitename),
'#description' => t('The site name to display for this domain.'),
);
$form['domain']['domain_scheme'] = array(
'#type' => 'radios',
'#title' => t('Domain URL scheme'),
'#required' => TRUE,
'#options' => array(
'http' => 'http://',
'https' => 'https://',
),
'#default_value' => variable_get('domain_scheme', 'http'),
'#description' => t('The URL scheme for accessing the primary domain.'),
);
$form['domain_behavior'] = array(
'#type' => 'fieldset',
'#title' => t('Domain module behaviors'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['domain_behavior']['domain_behavior'] = array(
'#type' => 'radios',
'#title' => t('New content settings'),
'#required' => TRUE,
'#default_value' => variable_get('domain_behavior', DOMAIN_INSTALL_RULE),
'#options' => array(
1 => t('Show on all affiliate sites'),
2 => t('Only show on selected sites'),
),
'#description' => t('If set to <em>Show on all affiliate sites</em>, this value will automatically assign new content to all affiliates.<br />If set to <em>Only show on selected sites</em>, you must configure the <a href="!url">Node-type specific settings</a>.', array(
'!url' => url('admin/build/domain/advanced'),
)),
);
$form['domain_behavior']['domain_debug'] = array(
'#type' => 'radios',
'#title' => t('Debugging status'),
'#required' => TRUE,
'#default_value' => variable_get('domain_debug', 0),
'#options' => array(
0 => t('Do not show debugging output'),
1 => t('Show debugging output on node view'),
),
'#description' => t('If set, users with the <em>set domain access</em> permission will be able to view the node access rules for each node. See the README for more details.'),
);
$form['domain_behavior']['domain_force_admin'] = array(
'#type' => 'radios',
'#title' => t('Enforce rules on administrators'),
'#required' => TRUE,
'#default_value' => variable_get('domain_force_admin', 0),
'#options' => array(
0 => t('Do not enforce'),
1 => t('Restrict node views for administrators'),
),
'#description' => t('If set, users with the <em>administer nodes</em> permission and user 1 <em>will view the site with Domain Access restrictions enforced</em>. See the README for more details.'),
);
$options = array(
'id' => t('Creation order, oldest > newest'),
'rid' => t('Creation order, newest > oldest'),
'name' => t('Sitename, A > Z'),
'rname' => t('Sitename, Z > A'),
'url' => t('URL, A > Z'),
'rurl' => t('URL, Z > A'),
);
$form['domain_behavior']['domain_sort'] = array(
'#type' => 'radios',
'#title' => t('Sort domain lists'),
'#required' => TRUE,
'#default_value' => variable_get('domain_sort', 'id'),
'#options' => $options,
'#description' => t('Controls the display of domain lists to end users.'),
);
$form['domain_behavior']['domain_list_size'] = array(
'#type' => 'select',
'#title' => t('Domain list size'),
'#required' => TRUE,
'#default_value' => variable_get('domain_list_size', DOMAIN_LIST_SIZE),
'#options' => drupal_map_assoc(array(
5,
10,
20,
25,
30,
40,
50,
75,
100,
150,
200,
250,
500,
750,
1000,
)),
'#description' => t('Sets a break point for the size of domain lists shown to users. After this point, user interfaces will use tables, pagination, and select lists to prevent too many domains from appearing in a list. <em>Note: setting this value higher than 200 may cause memory and display issues for your site.</em>'),
);
$form['domain_behavior']['domain_select_format'] = array(
'#type' => 'select',
'#title' => t('Domain selection format'),
'#required' => TRUE,
'#default_value' => domain_select_format(),
'#options' => array(
t('Checkboxes'),
t('Select list'),
),
'#description' => t('Determines the display format of form elements that display domain lists.'),
);
$form['domain_advanced'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['domain_advanced']['domain_www'] = array(
'#type' => 'radios',
'#title' => t('WWW prefix handling'),
'#default_value' => variable_get('domain_www', 0),
'#options' => array(
0 => t('Process all host requests normally'),
1 => t('Treat www.*.example.com as an alias of *.example.com'),
),
'#description' => t('If set, calls to www.* will be treated as if the www. did not exist.
<em>Users will be taken from www.example.com to example.com, so your domains must be registered without the www. prefix.</em>'),
);
// Check to see if the node_access patch is enabled. If it is, then
// we need to know if more than one node_access module is running.
$modules = count(module_implements('node_grants'));
if (!function_exists('node_access_grants_sql') || $modules < 2) {
$disabled = TRUE;
variable_set('domain_access_rules', 0);
}
// Do not show this form element unless it is necessary
if ($modules > 1) {
$form['domain_advanced']['domain_access_rules'] = array(
'#type' => 'radios',
'#title' => t('Node access settings'),
'#disabled' => $disabled,
'#default_value' => variable_get('domain_access_rules', 0),
'#options' => array(
0 => t('Use the default Drupal behavior (OR)'),
1 => t('Check Domain Access in addition to other modules (AND)'),
),
'#description' => t('Controls how Domain Access interacts with access control modules such as Organic Groups. Requires the multiple_node_access patch.'),
);
}
$form['domain_advanced']['domain_search'] = array(
'#type' => 'radios',
'#title' => t('Search settings'),
'#default_value' => variable_get('domain_search', 0),
'#options' => array(
0 => t('Search content for the current domain only'),
1 => t('Search all domains from any URL'),
),
'#description' => t('Options for content searching.'),
);
$form['domain_advanced']['domain_seo'] = array(
'#type' => 'radios',
'#title' => t('Search engine optimization'),
'#default_value' => variable_get('domain_seo', 0),
'#options' => array(
0 => t('Do not rewrite URLs'),
1 => t('Rewrite all URLs to point to a single source'),
),
'#description' => t('If rewrite is turned on, all node links will point to a single instance of the node. This
option reduces the chance that search engines will recognize duplicate content.'),
);
$options = array(
'-1' => t('Do not change domain'),
);
foreach (domain_domains() as $data) {
// The domain must be valid.
if ($data['valid']) {
$options[$data['domain_id']] = $data['sitename'];
}
}
$form['domain_advanced']['domain_default_source'] = array(
'#type' => 'select',
'#title' => t('Default source domain'),
'#options' => $options,
'#default_value' => variable_get('domain_default_source', 0),
'#description' => t('When rewriting urls, nodes assigned to all affiliates will be sent to this domain. <em>NOTE: This option only fires if you enable SEO rewrites or use the Domain Source module.</em>'),
);
$form['domain_all'] = array(
'#type' => 'fieldset',
'#title' => t('Special page requests'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['domain_all']['domain_grant_all'] = array(
'#type' => 'textarea',
'#rows' => 5,
'#cols' => 40,
'#default_value' => variable_get('domain_grant_all', "user/*/track"),
'#description' => t('Content on these pages should be viewable on any domain. Enter one path per line.
You may use the * as a wildcard. Use this for aggregate pages like those provided by <a href="!url">MySite</a> or if you
intend to show all user posts on a specific page. See the README for more details.', array(
'!url' => 'http://drupal.org/project/mysite',
)),
);
$form['domain_all']['domain_cron_rule'] = array(
'#type' => 'checkbox',
'#default_value' => variable_get('domain_cron_rule', 1),
'#title' => t('Treat cron.php as a special page request.'),
'#description' => t('Normally, you should leave this setting active. See the README for more information.'),
);
$form['domain_all']['domain_xmlrpc_rule'] = array(
'#type' => 'checkbox',
'#default_value' => variable_get('domain_xmlrpc_rule', 0),
'#title' => t('Treat xmlrpc.php as a special page request.'),
'#description' => t('Enable this setting if you have trouble with remote data calls over XMLRPC. See the README for more information.'),
);
$form['domain_paths'] = array(
'#type' => 'fieldset',
'#title' => t('Node link patterns'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['domain_paths']['domain_paths'] = array(
'#type' => 'textarea',
'#rows' => 5,
'#cols' => 40,
'#default_value' => variable_get('domain_paths', "node/%n\r\nnode/%n/edit\r\ncomment/reply/%n\r\nnode/add/book/parent/%n\r\nbook/export/html/%n\r\nnode/%n/outline"),
'#description' => t('When using SEO or other path rewrites, the following link paths should be turned into absolute URLs. Enter
the Drupal path of the link, using the <em>%n</em> placeholder to represent the node id.
Enter one path per line. See the README for more details.'),
);
// Allow submodules to add elements to the form.
$modules = module_implements('domainform');
if (!empty($modules)) {
foreach ($modules as $module) {
$func = $module . '_domainform';
$func($form);
}
}
// Add our additional submit handlers.
$form['#submit'] = array(
'domain_configure_form_submit',
);
return system_settings_form($form);
}