You are here

function tokenauth_admin_settings in Token authentication 7

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

Menu callback for Tokenauth administration interface.

1 string reference to 'tokenauth_admin_settings'
tokenauth_menu in ./tokenauth.module
Implements 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>',
    )),
  );
  $text = tokenauth_text_load();
  $form['tokenauth_text'] = array(
    '#type' => 'text_format',
    '#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.'),
    '#default_value' => $text['value'],
    '#format' => $text['format'],
    '#rows' => 5,
  );
  if (module_exists('token')) {
    $form['tokenauth_text']['token_help'] = array(
      '#title' => t('Replacement tokens'),
      '#type' => 'fieldset',
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#weight' => 10,
    );
    $form['tokenauth_text']['token_help']['view'] = array(
      '#theme' => 'token_tree',
      '#token_types' => array(
        'user',
      ),
      '#global_types' => TRUE,
      '#click_insert' => TRUE,
    );
  }
  $form['tokenauth_advanced'] = array(
    '#type' => 'fieldset',
    '#title' => t('Token actions'),
    '#weight' => 15,
    '#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);
}