You are here

function tokenauth_admin_settings in Token authentication 6.2

Same name and namespace in other branches
  1. 5 tokenauth.module \tokenauth_admin_settings()
  2. 6 tokenauth.pages.inc \tokenauth_admin_settings()
  3. 7 tokenauth.pages.inc \tokenauth_admin_settings()

Menu callback for Tokenauth administration interface.

1 string reference to 'tokenauth_admin_settings'
tokenauth_menu in ./tokenauth.module
Implementation of hook_menu().

File

./tokenauth.pages.inc, line 11
Provides administrative user interface for Tokenauth module.

Code

function tokenauth_admin_settings() {
  $form = array();
  $form['tokenauth_general'] = array(
    '#type' => 'fieldset',
    '#title' => t('Token settings'),
  );
  $form['tokenauth_general']['tokenauth_length'] = array(
    '#type' => 'textfield',
    '#title' => t('Token length'),
    '#size' => 4,
    '#maxlength' => 4,
    '#required' => TRUE,
    '#default_value' => variable_get('tokenauth_length', TOKENAUTH_DEFAULT_TOKEN_LENGTH),
    '#description' => t('Does not affect existing tokens.'),
  );
  $form['tokenauth_general']['tokenauth_pages'] = array(
    '#type' => 'textarea',
    '#title' => t('Activate tokens on specific pages'),
    '#default_value' => variable_get('tokenauth_pages', "rss.xml\n*/feed\n*/opml"),
    '#description' => t("Enter one page 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. Read <a href=\"http://api.drupal.org/api/function/drupal_match_path/6\">drupal_match_path()</a> for the details.", array(
      '%blog' => 'blog',
      '%blog-wildcard' => 'blog/*',
      '%front' => '<front>',
    )),
  );
  $form['tokenauth_text'] = array(
    '#type' => 'fieldset',
    '#title' => t('User text'),
    '#description' => t('This text will be displayed on a tab in each user\'s profile. Use it to explain what functionality Tokenauth provides your site.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#tree' => TRUE,
  );
  $tokenauth_text = tokenauth_text_load();
  $form['tokenauth_text']['body'] = array(
    '#type' => 'textarea',
    '#title' => t('Body'),
    '#default_value' => $tokenauth_text['body'],
    '#rows' => 5,
  );
  $form['tokenauth_text']['format'] = filter_form(FILTER_FORMAT_DEFAULT);
  if (module_exists('token')) {
    $form['tokenauth_text']['view']['token_help'] = array(
      '#title' => t('Replacement patterns'),
      '#type' => 'fieldset',
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    $form['tokenauth_text']['view']['token_help']['help'] = array(
      '#value' => theme('token_help', array(
        'user',
        'global',
      )),
    );
  }
  $form['tokenauth_advanced'] = array(
    '#type' => 'fieldset',
    '#title' => t('Token actions'),
    '#description' => t('Reset the tokens for all users. If you have changed token length, be sure to save that change before resetting all tokens.'),
  );
  $form['tokenauth_advanced']['tokenauth_reset'] = array(
    '#type' => 'submit',
    '#value' => t('Reset tokens'),
  );
  return system_settings_form($form);
}