You are here

function forward_admin_settings in Forward 6

Same name and namespace in other branches
  1. 5 forward.module \forward_admin_settings()
  2. 7.3 forward.admin.inc \forward_admin_settings()
  3. 7 forward.module \forward_admin_settings()
  4. 7.2 forward.admin.inc \forward_admin_settings()

Administration Page

1 string reference to 'forward_admin_settings'
forward_menu in ./forward.module
Menu Hooks

File

./forward.module, line 87

Code

function forward_admin_settings() {

  // Administrative Options
  $form['forward_options'] = array(
    '#type' => 'fieldset',
    '#title' => t('Administrative Options'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['forward_options']['forward_link_style'] = array(
    '#type' => 'radios',
    '#title' => t('Link style'),
    '#default_value' => variable_get('forward_link_style', 0),
    '#options' => array(
      0 => t('Text only'),
      1 => t('Icon only'),
      2 => t('Icon and text'),
    ),
    '#description' => t('Select the visual style of the link.'),
  );
  $form['forward_options']['forward_link_type'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use node type in link'),
    '#return_value' => 1,
    '#default_value' => variable_get('forward_link_type', FALSE),
    '#description' => t('If checked, the link will read &quot;email this <em>nodetype</em>&quot;; if not, it will just read &quot;email this page&quot;'),
  );
  $form['forward_options']['forward_link_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Link title'),
    '#size' => 40,
    '#default_value' => variable_get('forward_link_title', 'Email this !type'),
    '#description' => t('Set the text of the link.  Use !type as a place holder for the node\'s content type or \'page\' depending on the setting above.'),
  );
  $form['forward_options']['forward_display_nodes'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show Forward on nodes'),
    '#return_value' => 1,
    '#default_value' => variable_get('forward_display_nodes', TRUE),
    '#description' => t('If checked, the link/form will appear on nodes'),
  );
  $form['forward_options']['forward_display_teasers'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show Forward on teasers'),
    '#return_value' => 1,
    '#default_value' => variable_get('forward_display_teasers', FALSE),
    '#description' => t('If checked, the link/form will appear on teasers in lists of nodes'),
  );
  $form['forward_options']['forward_display_comments'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show Forward on comments'),
    '#return_value' => 1,
    '#default_value' => variable_get('forward_display_comments', FALSE),
    '#description' => t('If checked, the link/form will appear on comments'),
  );
  $form['forward_options']['forward_display_nonnode'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show Forward on non-node pages'),
    '#return_value' => 1,
    '#default_value' => variable_get('forward_display_nonnode', FALSE),
    '#description' => t('If checked, the link/form will appear on non-node pages like views and other module pages'),
  );
  $form['forward_options']['forward_theme_template'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use forward.tpl.php template instead of old style theme functions'),
    '#default_value' => variable_get('forward_theme_template', 0),
    '#description' => t('If you are upgrading from an old site and customized theme_forward_email or theme_forward_postcard, leave this unchecked unless you wish to convert your customizations to the new forward.tpl.php style.  If upgrading, make sure you flush the theme registry before making this change or Drupal may not find the new template.'),
  );
  $form['forward_options']['forward_form_type'] = array(
    '#type' => 'select',
    '#title' => t('Form type'),
    '#default_value' => variable_get('forward_form_type', 'link'),
    '#options' => array(
      'link' => t('link'),
      'form' => t('form'),
    ),
    '#description' => t('Select link for a forward this page link or form to use a collapsible forwarding form.'),
  );
  $form['forward_options']['forward_flood_control'] = array(
    '#type' => 'select',
    '#title' => t('Flood control limit'),
    '#default_value' => variable_get('forward_flood_control', 10),
    '#options' => array(
      '1' => '1',
      '5' => '5',
      '10' => '10',
      '15' => '15',
      '20' => '20',
      '25' => '25',
      '30' => '30',
      '35' => '35',
      '40' => '40',
      '50' => '50',
    ),
    '#description' => t('How many times a user can use the form in a one hour period. This will help prevent the forward module from being used for spamming.'),
  );
  $form['forward_options']['forward_flood_error'] = array(
    '#type' => 'textarea',
    '#title' => t('Flood control error'),
    '#default_value' => variable_get('forward_flood_error', t("You can't send more than !number messages per hour. Please try again later.")),
    '#cols' => 40,
    '#rows' => 10,
    '#description' => t('This text appears if a user exceeds the flood control limit.  The value of the flood control limit setting will appear in place of !number in the message presented to users'),
  );
  $form['forward_options']['forward_flood_control_clicks'] = array(
    '#type' => 'select',
    '#title' => t('Flood control limit for clickthrough tracking'),
    '#default_value' => variable_get('forward_flood_control_clicks', 20),
    '#options' => array(
      '5' => '5',
      '10' => '10',
      '15' => '15',
      '20' => '20',
      '25' => '25',
      '30' => '30',
      '35' => '35',
      '40' => '40',
      '45' => '45',
      '50' => '50',
    ),
    '#description' => t('How many times per hour clickthroughs will be tracked from a single IP address. This will help prevent manipulation of forward clickthrough statistics.'),
  );
  $form['forward_options']['forward_message'] = array(
    '#type' => 'select',
    '#title' => t('Personal messages'),
    '#options' => array(
      0 => 'Disabled',
      1 => 'Optional',
      2 => 'Required',
    ),
    '#default_value' => variable_get('forward_message', 1),
    '#description' => t('Choose whether the personal message field will be disabled, optional, or required.'),
  );
  $form['forward_options']['forward_filter_html'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow HTML in personal messages'),
    '#return_value' => 1,
    '#default_value' => variable_get('forward_filter_html', FALSE),
    '#description' => t('If checked, will filter XSS and all tags not allowed below from the custom body field.  Otherwise, the body will converted to plain text with all HTML converted to character entities'),
  );
  $form['forward_options']['forward_filter_tags'] = array(
    '#type' => 'textfield',
    '#title' => t('Allowed HTML tags'),
    '#size' => 40,
    '#default_value' => variable_get('forward_filter_tags', 'p,br,em,strong,cite,code,ul,ol,li,dl,dt,dd'),
    '#description' => t('List of allowed tags (separated by commas) that will be allowed by the XSS filter if enabled above.  The default tags allowed are: p,br,em,strong,cite,code,ul,ol,li,dl,dt,dd'),
  );
  $form['forward_options']['forward_sender_address'] = array(
    '#type' => 'textfield',
    '#title' => t('From address'),
    '#default_value' => variable_get('forward_sender_address', variable_get('site_mail', '')),
    '#size' => 40,
    '#maxlength' => 40,
    '#description' => t('If left blank, the from address entered in the form will be used as the from address for the email.  Enter a valid email address here to override that.  The sender\'s email will still appear in the body of the message.'),
  );
  $types = node_get_types();
  $options = array();
  $defaults = array();
  foreach ($types as $type => $info) {
    $options[$type] = check_plain($info->name);
    if (variable_get('forward_display_' . $type, TRUE)) {
      $defaults[] = $type;
    }
  }
  $form['forward_options']['forward_display_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Content types'),
    '#options' => $options,
    '#default_value' => $defaults,
    '#description' => t('Choose which content types to display the Forward link on.'),
  );
  $form['forward_options']['forward_thankyou_send'] = array(
    '#type' => 'checkbox',
    '#title' => t('Send a thank you email'),
    '#return_value' => 1,
    '#default_value' => variable_get('forward_thankyou_send', FALSE),
    '#description' => t('If checked, Forward will send a thank you email to the user.'),
  );
  $form['forward_options']['forward_thankyou_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Thank you email subject'),
    '#default_value' => variable_get('forward_thankyou_subject', 'Thank you for spreading the word about !site'),
  );
  $form['forward_options']['forward_thankyou_text'] = array(
    '#type' => 'textarea',
    '#title' => t('Thank you email text'),
    '#default_value' => variable_get('forward_thankyou_text', "Dear !name,\n\nThank you for your help in spreading the word about !site.  We appreciate your help."),
    '#cols' => 40,
    '#rows' => 10,
    '#description' => t('This message will be emailed to the user if the Send a thank you email checkbox above is checked.  The token !site will be replaced with the site name and !name will be replaced with the user\'s name supplied on the forward form.'),
  );

  // Page Text Values
  $form['forward_text_values'] = array(
    '#type' => 'fieldset',
    '#title' => t('Page Text Values'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['forward_text_values']['forward_instructions'] = array(
    '#type' => 'textarea',
    '#title' => t('Forward Instructions'),
    '#default_value' => variable_get('forward_instructions', '<p>Thank you for your interest in spreading the word about !site.</p><p>NOTE: We only request your email address so that the person you are recommending the page to knows that you wanted them to see it, and that it is not junk mail. We do not capture any email address.</p>'),
    '#cols' => 40,
    '#rows' => 10,
    '#description' => t('This message will be displayed above the form.  The token !site will be replaced with the site name.'),
  );
  $form['forward_text_values']['forward_thankyou'] = array(
    '#type' => 'textarea',
    '#title' => t('Thank You Message'),
    '#default_value' => variable_get('forward_thankyou', 'Thank you for your help in spreading the word about !site.  We appreciate your help.'),
    '#cols' => 40,
    '#rows' => 10,
    '#description' => t('This message will be displayed after the user successfully submits the form.  The token !site will be replaced with the site name.'),
  );

  // Forward Form Default Values
  $form['forward_email_defaults'] = array(
    '#type' => 'fieldset',
    '#title' => t('Default Values for Email This Page'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#description' => t('These options will set the default values for the "email this page" form.'),
  );
  $form['forward_email_defaults']['forward_width'] = array(
    '#type' => 'textfield',
    '#title' => t('Email width'),
    '#default_value' => variable_get('forward_width', 400),
    '#size' => 10,
    '#description' => t('Set a width for the table in the email template.  Ideally, this should be somewhere between 400 and 600 pixels to avoid breaking the layout in various email clients.'),
    '#attributes' => FALSE,
  );
  $form['forward_email_defaults']['forward_header_image'] = array(
    '#type' => 'textfield',
    '#title' => t('Header Image for Email'),
    '#default_value' => variable_get('forward_header_image', ''),
    '#size' => 40,
    '#maxlength' => 256,
    '#description' => t('Enter the URL of the image to as a logo at the top of forwarded pages.'),
    '#attributes' => FALSE,
  );
  $form['forward_email_defaults']['forward_email_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Forward Page Title'),
    '#default_value' => variable_get('forward_email_title', t('Forward this page')),
    '#size' => 40,
    '#maxlength' => 256,
    '#description' => t('Title to display above the Forward page form'),
  );
  $form['forward_email_defaults']['forward_email_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Forward Message Subject'),
    '#default_value' => variable_get('forward_email_subject', t('!name has forwarded a page to you from !site')),
    '#size' => 40,
    '#maxlength' => 256,
    '#description' => t('Email subject line.  The sender\'s name will appear in place of !name in the subject.  The web site name will be inserted in place of !site.'),
  );
  $form['forward_email_defaults']['forward_email_message'] = array(
    '#type' => 'textarea',
    '#title' => t('Forward Message Body'),
    '#default_value' => variable_get('forward_email_message', t('!name thought you would like to see this page from the !site web site.')),
    '#cols' => 40,
    '#rows' => 10,
    '#description' => t('Email message body.  The sender\'s name will appear in place of !name in the message body.  The web site name will be inserted in place of !site.  The sender will be able to add their own message after this.'),
  );
  $form['forward_email_defaults']['forward_full_body'] = array(
    '#type' => 'checkbox',
    '#title' => t('Include full node'),
    '#return_value' => 1,
    '#default_value' => variable_get('forward_full_body', FALSE),
    '#description' => t('If checked, Forward will include the full body of the node rather than just the teaser'),
  );

  // Forward Form Default Values
  $form['forward_epostcard_defaults'] = array(
    '#type' => 'fieldset',
    '#title' => t('Default Values for e-Postcard'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#description' => t('These options will set the default values for the "Send an e-Postcard" form.'),
  );
  $form['forward_epostcard_defaults']['forward_epostcard_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Forward e-Postcard Title'),
    '#default_value' => variable_get('forward_epostcard_title', t('Send an e-Postcard')),
    '#size' => 40,
    '#maxlength' => 256,
    '#description' => t('Title to display above the Forward page form'),
  );
  $form['forward_epostcard_defaults']['forward_epostcard_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('e-Postcard Message Subject'),
    '#default_value' => variable_get('forward_epostcard_subject', t('!name has sent you an e-postcard from !site')),
    '#size' => 40,
    '#maxlength' => 256,
    '#description' => t('Postcard subject line.  The sender\'s name will appear in place of !name in the subject.  The web site name will be inserted in place of !site.'),
  );
  $form['forward_epostcard_defaults']['forward_epostcard_message'] = array(
    '#type' => 'textarea',
    '#title' => t('e-Postcard Message Body'),
    '#default_value' => variable_get('forward_epostcard_message', t('!name has sent you an e-postcard from the !site web site.  Please take a moment to visit our web site.')),
    '#cols' => 40,
    '#rows' => 10,
    '#description' => t('Postcard message body.  The sender\'s name will appear in place of !name in the message body.  The web site name will be inserted in place of !site.  The sender will be able to add their own message after this.  You can use HTML in this field to add a special postcard image to the email above the sender\'s message.'),
  );
  $form['forward_epostcard_defaults']['forward_ad_footer'] = array(
    '#type' => 'textarea',
    '#title' => t('Organization Ad'),
    '#default_value' => variable_get('forward_ad_footer', " "),
    '#cols' => 40,
    '#rows' => 10,
    '#description' => t('This message will be just above the footer message in the email.'),
  );
  $form['forward_epostcard_defaults']['forward_footer'] = array(
    '#type' => 'textarea',
    '#title' => t('Footer Message'),
    '#default_value' => variable_get('forward_footer', " "),
    '#cols' => 40,
    '#rows' => 4,
    '#description' => t('This message will be appended as a footer message to the email.'),
  );
  $form['forward_epostcard_defaults']['forward_epostcard_return'] = array(
    '#type' => 'textfield',
    '#title' => t('e-Postcard Return URL'),
    '#default_value' => variable_get('forward_epostcard_return', ''),
    '#size' => 40,
    '#description' => t('URL of path to redirect users to after submitting the epostcard form.'),
  );

  // Dynamic Block settings
  $form['forward_dynamic_block_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Dynamic Block Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#description' => t('These options control whether sent emails include dynamic block content.'),
  );
  $dyn_options = array(
    'node' => t('Latest Blog Articles'),
    'user' => t('Latest Users'),
    'comment' => t('Latest Comments'),
    'popular' => t('Most Popular Content'),
    'none' => t('None'),
  );
  $form['forward_dynamic_block_settings']['forward_dynamic_block'] = array(
    '#type' => 'radios',
    '#title' => t('Dynamic Block'),
    '#default_value' => variable_get('forward_dynamic_block', 'none'),
    '#options' => $dyn_options,
    '#description' => t('Choose the dynamic block to send with these emails'),
    '#required' => TRUE,
    '#attributes' => NULL,
  );
  $acl_options = array(
    'recipient' => t('If one email address is entered in the Send To field and it corresponds to an active Drupal account, use the permissions of that account.  Otherwise use anonymous visitor permissions. <em>(default)</em>'),
    'anonymous' => t('Always use the anonymous visitor permissions.'),
    'sender' => t('Use the permissions of the person sending the email.'),
    'none' => t('Bypass access control.  This mimics the behavior prior to release 6.x-1.21. <em>Warning: selecting this option has security implications.</em>'),
  );
  $form['forward_dynamic_block_settings']['forward_block_access_control'] = array(
    '#type' => 'radios',
    '#title' => t('Dynamic Block Access Control'),
    '#default_value' => variable_get('forward_block_access_control', 'recipient'),
    '#options' => $acl_options,
    '#description' => t('Select the type of access control to apply to the dynamic block.  This determines which content will be included in the block. Most sites should use the default.'),
    '#required' => TRUE,
    '#attributes' => NULL,
  );
  $form['#submit'][] = 'forward_admin_settings_submit';
  return system_settings_form($form);
}