function query_parameters_to_url_admin_settings in Query Parameters To URL 7
Admin settings page callback.
1 string reference to 'query_parameters_to_url_admin_settings'
- query_parameters_to_url_menu in ./
query_parameters_to_url.module - Implements hook_menu().
File
- ./
query_parameters_to_url.admin.inc, line 10 - Administration pages.
Code
function query_parameters_to_url_admin_settings() {
$form = array();
$default_options = array(
'#states' => array(
'enabled' => array(
':input[name="' . QUERY_PARAMETERS_TO_URL_ENABLED . '"]' => array(
'checked' => TRUE,
),
),
),
);
$form[QUERY_PARAMETERS_TO_URL_ENABLED] = array(
'#type' => 'checkbox',
'#title' => t('Enable rewriting'),
'#description' => t('If checked, URLs containing query parameters will be rewritten to Clean URL components.'),
'#default_value' => variable_get(QUERY_PARAMETERS_TO_URL_ENABLED, TRUE),
);
$form[QUERY_PARAMETERS_TO_URL_URL_AND_QUERY_DELIMITER] = array(
'#type' => 'textfield',
'#title' => t('URL and query parameters delimiter'),
'#description' => t('This string will be placed in the URL, between real URL components and encoded query parameters.<br/><strong>Example:</strong> If the accessed URI is <string>events/all?category=1&page=2</string> the resulting clean URL will be <strong>events/all/p/category/1/page/2</strong>.'),
'#default_value' => query_parameters_to_url_url_query_delimiter(),
) + $default_options;
$form[QUERY_PARAMETERS_TO_URL_QUERY_NESTED_KEY_DELIMITER] = array(
'#type' => 'textfield',
'#title' => t('Query parameter nested key delimiter'),
'#description' => t('This string will be used to delimit nested keys for a parameter value.<br/><strong>Example:</strong> If the accessed URI is <strong>events?category_id[0][1][2][3][4]=5</strong> the resulting clearn URL will be <strong>events/all/p/category_id/0__1__2__3__4__5</strong>.'),
'#default_value' => query_parameters_to_url_nested_key(),
) + $default_options;
$form[QUERY_PARAMETERS_TO_URL_QUERY_NESTED_VALUES_DELIMITER] = array(
'#type' => 'textfield',
'#title' => t('Query parameter nested values delimiter'),
'#description' => t('This string will be used to delimit nested parameter values from one another.<br/><strong>Example:</strong> If the accessed URI is <strong>events?category_id[0][1]=2&category_id[3][4]=5</strong> the resulting clearn URL will be <strong>events/all/p/category_id/0__1__2--3__4__5</strong>.'),
'#default_value' => query_parameters_to_url_nested_values_delimiter(),
) + $default_options;
$form[QUERY_PARAMETERS_TO_URL_PATH_REG_EXP] = array(
'#type' => 'textfield',
'#title' => t('Regular expression to match paths, where rewriting should be enabled'),
'#description' => t("While you can always reset this configuration and recover without permanent damage to your site, a change to this expression will break old bookmarked URLs. Change only when you know what you're doing.<br>Example: <strong>{(^home|^events|^news/all)}</strong>. To match all paths you can use: <strong>{.+}</strong>. To disable regular expression matching, leave it empty."),
'#default_value' => query_parameters_to_url_path_reg_exp(),
) + $default_options;
$form['advanced_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#tree' => FALSE,
);
$form['advanced_settings']['hook_hint'] = array(
'#type' => 'item',
'#title' => t('Additional paths'),
'#description' => t('You can enable rewriting for additional paths, by implementing <strong>hook_query_parameters_to_url_rewrite_access()</strong>.'),
) + $default_options;
$form['advanced_settings'][QUERY_PARAMETERS_TO_URL_ADDITIONAL_PATHS_HOOKS_ENABLED] = array(
'#type' => 'checkbox',
'#title' => t('Enable hook invocation to find additional paths'),
'#description' => t('If checked, <strong>hook_query_parameters_to_url_rewrite_access()</strong> implementations will be invoked, to allow support for additional rewrite paths.'),
'#default_value' => query_parameters_to_url_additional_paths_hooks_enabled(),
) + $default_options;
$form['advanced_settings'][QUERY_PARAMETERS_TO_URL_REWRITE_HOOKS_ENABLED] = array(
'#type' => 'checkbox',
'#title' => t('Enable hook invocation to allow rewriting the final encoded paths'),
'#description' => t('If checked, <strong>hook_query_parameters_to_url_rewrite_alter()</strong> implementations will be invoked, to allow rewriting the final query parameter encoded URLs. See <em>query_parameters_to_url.api.php</em> for an example and documentation.'),
'#default_value' => query_parameters_to_url_rewrite_hooks_enabled(),
) + $default_options;
$form['advanced_settings'][QUERY_PARAMETERS_TO_URL_REDIRECT_PROTECTION_ENABLED] = array(
'#type' => 'checkbox',
'#title' => t('Enable protection against redirect loop'),
'#description' => t('If checked, each redirect in hook_init() is logged, to protect against any possible redirect loops, just like redirect module does it.'),
'#default_value' => query_parameters_to_url_redirect_protection_enabled(),
) + $default_options;
$form['advanced_settings'][QUERY_PARAMETERS_TO_URL_IGNORE_ADMIN_PATHS] = array(
'#type' => 'checkbox',
'#title' => t('Ignore admin paths'),
'#description' => t('Whether query parameter encoding should be skipped on admin paths.'),
'#default_value' => query_parameters_to_url_ignore_admin_paths(),
) + $default_options;
$form['advanced_settings'][QUERY_PARAMETERS_TO_URL_REDIRECT_PROTECTION_ENABLED] = array(
'#type' => 'textfield',
'#title' => t('Redirect loop threshold'),
'#description' => t('How many redirects are allowed in 15 seconds, before it is considered that a redirect loop has occurred.'),
'#default_value' => query_parameters_to_url_redirect_threshold(),
) + $default_options;
$form['advanced_settings'][QUERY_PARAMETERS_TO_URL_ALLOW_REWRITTEN_MENU_ITEM_SAVE] = array(
'#type' => 'checkbox',
'#title' => t('Allow rewritten menu item save'),
'#description' => t('If this is checked, you will be able to save an encoded query parameter path as a menu item. Which means you can add a menu item with a path like <em>events/p/page/1</em>. For saving an encoded query parameter path for the front page, make sure you prepend the front page path, like <em>home/p/page/1</em>. <strong>This is an experimental feature.</strong>'),
'#default_value' => query_parameters_to_url_allow_rewritten_menu_item_save(),
) + $default_options;
$form['advanced_settings'][QUERY_PARAMETERS_TO_URL_REDIRECT_STATUS_CODE] = array(
'#type' => 'select',
'#title' => t('HTTP code to use for redirects'),
'#description' => t('Choose which HTTP Code should be issued for redirects done by this module.'),
'#options' => query_parameters_to_url_status_code_options(),
'#default_value' => query_parameters_to_url_redirect_status_code(),
) + $default_options;
return system_settings_form($form);
}