1 redirect.admin.inc | redirect_settings_form($form, &$form_state) |
Form builder for redirection settings.
See also
Related topics
File
- core/
modules/ redirect/ redirect.admin.inc, line 667 - Admin page callbacks for the Redirect module.
Code
function redirect_settings_form($form, &$form_state) {
$config = config('redirect.settings');
$form['#config'] = 'redirect.settings';
$form['auto_redirect'] = array(
'#type' => 'checkbox',
'#title' => t('Automatically create redirects when URL aliases are changed.'),
'#default_value' => $config->get('auto_redirect'),
'#description' => t('This setting is most commonly used when replacing existing URL aliases under "Update action" in the <a href="!url">URL alias settings</a>.', array('!url' => url('admin/config/urls/path/patterns/settings'))),
'#disabled' => !module_exists('path'),
);
$form['passthrough_querystring'] = array(
'#type' => 'checkbox',
'#title' => t('Retain query string through redirect.'),
'#default_value' => $config->get('passthrough_querystring'),
'#description' => t('For example, given a redirect from %source to %redirect, if a user visits %source_query they would be redirected to %redirect_query. The query strings in the redirection will always take precedence over the current query string.', array('%source' => 'source-path', '%redirect' => 'node?a=apples', '%source_query' => 'source-path?a=alligators&b=bananas', '%redirect_query' => 'node?a=apples&b=bananas')),
);
$form['additional_statuses'] = array(
'#type' => 'radios',
'#title' => t('Redirect types'),
'#options' => array(
'0' => t('Show only common redirect types (301 and 302)'),
'1' => t('Show all redirect types (300, 301, 302, 303, 304, 305, and 307)'),
),
'#default_value' => $config->get('additional_statuses') ? '1' : '0',
'#description' => t('<a href="https://wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection">More information about status codes</a>.'),
);
$form['purge_inactive'] = array(
'#type' => 'select',
'#title' => t('Delete redirects that have not been accessed for'),
'#default_value' => $config->get('purge_inactive'),
'#options' => array(0 => t('Never (do not discard)')) + backdrop_map_assoc(array(604800, 1209600, 1814400, 2592000, 5184000, 7776000, 10368000, 15552000, 31536000), 'format_interval'),
'#description' => t('Only redirects managed by the redirect module itself will be deleted. Redirects managed by other modules will be left alone.'),
);
return system_settings_form($form);
}