You are here

function guestbook_admin_settings in Guestbook 5

Same name and namespace in other branches
  1. 5.2 guestbook.module \guestbook_admin_settings()
  2. 6.2 guestbook.module \guestbook_admin_settings()
  3. 6 guestbook.module \guestbook_admin_settings()
  4. 7.2 guestbook.module \guestbook_admin_settings()

Implementation of hook_settings().

1 string reference to 'guestbook_admin_settings'
guestbook_menu in ./guestbook.module
Implementation of hook_menu().

File

./guestbook.module, line 184

Code

function guestbook_admin_settings() {
  $form['guestbook_mode'] = array(
    '#type' => 'radios',
    '#title' => t('Mode'),
    '#default_value' => variable_get('guestbook_mode', GUESTBOOK_SITE_GUESTBOOK | GUESTBOOK_USER_GUESTBOOKS),
    '#options' => array(
      GUESTBOOK_SITE_GUESTBOOK | GUESTBOOK_USER_GUESTBOOKS => t('Site and user guestbooks'),
      GUESTBOOK_SITE_GUESTBOOK => t('Site guestbook only'),
      GUESTBOOK_USER_GUESTBOOKS => t('User guestbooks only'),
    ),
  );

  // Site guestbook.
  $form['site_guestbook'] = array(
    '#type' => 'fieldset',
    '#title' => t('Site guestbook'),
  );
  $form['site_guestbook']['guestbook_site_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Title'),
    '#default_value' => variable_get('guestbook_site_title', t('Site guestbook')),
    '#size' => 30,
    '#maxlength' => 128,
    '#description' => t("The site guestbook's page title."),
  );
  $form['site_guestbook']['guestbook_site_intro'] = array(
    '#type' => 'textarea',
    '#title' => t('Intro text'),
    '#default_value' => variable_get('guestbook_site_intro', ''),
    '#cols' => 70,
    '#rows' => GUESTBOOK_TEXTAREA_ROWS,
    '#description' => t('The text that appears on top of the site guestbook.'),
  );
  $form['site_guestbook']['guestbook_send_email'] = array(
    '#type' => 'textfield',
    '#title' => t('Send an notification to the following e-mail address about new guestbook entries'),
    '#description' => t("Leave blank if you don't wish to be notified"),
    '#size' => 30,
    '#maxlength' => 128,
    '#default_value' => variable_get('guestbook_send_email', ''),
  );

  // User guestbooks.
  $form['user_guestbooks'] = array(
    '#type' => 'fieldset',
    '#title' => t('User guestbooks'),
    '#description' => t('Users can individually disable their guestbook or add an intro text on the user account page.'),
  );
  $form['user_guestbooks']['guestbook_user_link_to'] = array(
    '#type' => 'radios',
    '#title' => t('User link to profile or guestbook'),
    '#description' => t('When displaying a user should the link show the user profile or the user guestbook?'),
    '#options' => array(
      'profile' => t('User profile'),
      'guestbook' => t('User guestbook'),
    ),
    '#default_value' => variable_get('guestbook_user_link_to', 'profile'),
  );

  // Display options.
  $form['display_options'] = array(
    '#type' => 'fieldset',
    '#title' => t('Display options'),
  );
  $form['display_options']['guestbook_entries_per_page'] = array(
    '#type' => 'textfield',
    '#title' => t('Entries per page'),
    '#default_value' => variable_get('guestbook_entries_per_page', 20),
    '#size' => 3,
    '#maxlength' => 3,
    '#description' => t('The number of guestbook entries per page.'),
  );
  $form['display_options']['guestbook_display'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Toggle display'),
    '#default_value' => variable_get('guestbook_display', array(
      'date',
      'email',
      'website',
      'comments',
    )),
    '#options' => array(
      'date' => t('Submission date'),
      'email' => t('Anonymous poster e-mail'),
      'website' => t('Anonymous poster website'),
      'comments' => t('Comments'),
    ),
  );
  $form['display_options']['guestbook_pager_position'] = array(
    '#type' => 'radios',
    '#title' => t('Position of pager'),
    '#default_value' => variable_get('guestbook_pager_position', GUESTBOOK_PAGER_BELOW),
    '#options' => array(
      GUESTBOOK_PAGER_ABOVE => t('Above the entries'),
      GUESTBOOK_PAGER_BELOW => t('Below the entries'),
      GUESTBOOK_PAGER_ABOVE | GUESTBOOK_PAGER_BELOW => t('Above and below the entries'),
    ),
  );

  // Posting settings.
  $form['posting_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Posting settings'),
  );
  $form['posting_settings']['guestbook_input_format'] = filter_form(variable_get('guestbook_input_format', 0), NULL, array(
    'guestbook_input_format',
  ));
  $form['posting_settings']['guestbook_input_format']['#type'] = 'item';
  $form['posting_settings']['guestbook_filter_tips'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display filter tips'),
    '#default_value' => variable_get('guestbook_filter_tips', TRUE),
    '#description' => t('If enabled filter tips are displayed below the message textarea.'),
  );
  $form['posting_settings']['guestbook_anonymous_fields'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Anonymous poster fields'),
    '#default_value' => variable_get('guestbook_anonymous_fields', array(
      'email',
      'website',
    )),
    '#description' => t('Additional information that anonymous posters may supply.'),
    '#options' => array(
      'email' => 'E-mail',
      'website' => 'Website',
    ),
  );
  $form['posting_settings']['guestbook_form_location'] = array(
    '#type' => 'radios',
    '#title' => t('Location of entry submission form'),
    '#default_value' => variable_get('guestbook_form_location', 'above'),
    '#options' => array(
      'above' => t('Above entries'),
      'below' => t('Below entries'),
      'separate page' => t('Separate page'),
    ),
  );
  $form['array_filter'] = array(
    '#type' => 'value',
    '#value' => TRUE,
  );
  return system_settings_form($form);
}