function me_admin_settings_form in me aliases 8
Same name and namespace in other branches
- 6.2 me.module \me_admin_settings_form()
- 6 me.module \me_admin_settings_form()
- 7 me.module \me_admin_settings_form()
Form callback for the admin settings form.
File
- ./
me.module, line 544 - Provides 'me' aliases to allow users to enter 'me' in common paths instead of their user id.
Code
function me_admin_settings_form($form, &$form_state) {
$form = array();
$form['me_alias'] = array(
'#type' => 'textfield',
'#title' => t("'Me' Alias"),
'#description' => t('The alias to use to represent the current users uid.'),
'#default_value' => me_variable_get('me_alias'),
'#required' => TRUE,
);
$form['me_token_help'] = array(
'#title' => t('Replacement patterns for me alias'),
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'help' => array(
'#type' => 'markup',
'#markup' => theme('token_tree'),
),
);
$form['me_case_insensitive'] = array(
'#type' => 'checkbox',
'#title' => t('Case Insensitive Alias Checking'),
'#description' => t('When checked, "Me" will be matched the same as "me", "ME", and "mE".'),
'#default_value' => me_variable_get('me_case_insensitive'),
);
$form['me_rewrite_link'] = array(
'#type' => 'checkbox',
'#title' => t('Rewrite links generated by the drupal menu system'),
'#description' => t('When checked, links output by the drupal menu system will replace uid with the me alias.'),
'#default_value' => me_variable_get('me_rewrite_link'),
);
$form['me_user_override'] = array(
'#type' => 'checkbox',
'#title' => t('Allow users to turn off me for their account'),
'#default_value' => me_variable_get('me_user_override'),
);
$form['me_redirect'] = array(
'#type' => 'checkbox',
'#title' => t('Redirect to uid'),
'#description' => t('When checked, perform a redirect so the users uid is shown in the address bar instead of the me alias.'),
'#default_value' => me_variable_get('me_redirect'),
);
$form['me_redirect_anonymous'] = array(
'#type' => 'textfield',
'#title' => t('Redirect anonymous users'),
'#description' => t('When this is non-empty, anonymous users will be redirected to the specified drupal path.'),
'#default_value' => me_variable_get('me_redirect_anonymous'),
);
$access = user_access('use PHP for me alias paths');
$path_rule = me_variable_get('me_path_rule');
$paths = me_variable_get('me_paths');
if ($path_rule == ME_PATH_PHP && !$access) {
$form['me_paths_settings'] = array();
$form['me_paths_settings']['me_path_rule'] = array(
'#type' => 'value',
'#value' => $path_rule,
);
$form['me_paths_settings']['me_paths'] = array(
'#type' => 'value',
'#value' => $paths,
);
}
else {
$options = array(
ME_PATH_EXCLUDE => t('Use me alias on every path except the listed paths.'),
ME_PATH_INCLUDE => t('Use me alias only on the listed paths.'),
);
$description = t("Enter one path per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array(
'%blog' => 'blog',
'%blog-wildcard' => 'blog/*',
'%front' => '<front>',
));
if ($access) {
$options[ME_PATH_PHP] = t('Use me alias if the following PHP code returns <code>TRUE</code> (PHP-mode, experts only).');
$description .= ' ' . t('If the PHP-mode is chosen, enter PHP code between %php. Note that executing incorrect PHP-code can break your Drupal site.', array(
'%php' => '<?php ?>',
));
}
$form['me_paths_settings']['me_path_rule'] = array(
'#type' => 'radios',
'#title' => t('Use me alias on specific paths'),
'#options' => $options,
'#default_value' => $path_rule,
);
$form['me_paths_settings']['me_paths'] = array(
'#type' => 'textarea',
'#title' => t('Paths'),
'#default_value' => $paths,
'#description' => $description . t('<p>NOTE: This option simply ensures that the browser address bar for these paths have the uid and not me. The me alias will still work for these paths. It will have no effect on specific uids in paths, but if the path includes the me alias, then me will be affected for those paths. This will only affect paths that me can already handle. It will not allow me to work for unknown paths.</p>'),
);
}
$form['#validate'] = array(
'me_admin_settings_form_validate',
);
$form = system_settings_form($form);
// Quite a few options only have an affect on theme and menu rebuilds. We just do them here
// to make sure the options have an instant effect.
$form['#submit'][] = 'menu_rebuild';
$form['#submit'][] = 'drupal_theme_rebuild';
return $form;
}