You are here

function sharethis_admin_settings in ShareThis 5

Same name and namespace in other branches
  1. 6.2 sharethis.admin.inc \sharethis_admin_settings()
  2. 6 sharethis.admin.inc \sharethis_admin_settings()

Menu callback; Settings administration.

1 string reference to 'sharethis_admin_settings'
sharethis_menu in ./sharethis.module

File

./sharethis.module, line 47
Provides the ShareThis service.

Code

function sharethis_admin_settings() {
  $form['sharethis_this_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('ShareThis API Code (STAPI)'),
    '#description' => t('The following javascript code can be modified to enhance the appearance of your ShareThis popup, and to determine which Social Networking sites are displayed.'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $sharethis_code = '<script type="text/javascript" src="http://w.sharethis.com/widget/?tabs=web&amp;charset=utf-8&amp;style=default&amp;publisher=79afd7f6-da74-4c6e-9bd9-3c199659901d&amp;headerbg=%2337a037"></script>';
  $form['sharethis_this_settings']['sharethis_sharethis_this_code'] = array(
    '#type' => 'textarea',
    '#title' => t('Share This Code'),
    '#description' => t('Javascript code provided by Share This. You can generate your own code !here.', array(
      '!here' => l(t('here'), 'http://sharethis.com/publisher?type=stapi'),
    )),
    '#default_value' => variable_get('sharethis_sharethis_this_code', $sharethis_code),
  );
  $form['where_to_sharethis_sharethis_this'] = array(
    // Where to Share
    '#type' => 'fieldset',
    '#title' => t('Node Types &amp; Positioning'),
    '#description' => t('Set the node types and categories you want to display links for.'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['where_to_sharethis_sharethis_this']['sharethis_sharethis_this_node_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Node types'),
    '#default_value' => variable_get('sharethis_sharethis_this_node_types', array()),
    '#options' => node_get_types('names'),
  );
  if (module_exists('taxonomy')) {
    $terms = taxonomy_form_all();
    if (!empty($terms)) {
      $form['where_to_sharethis_sharethis_this']['sharethis_sharethis_this_category_types'] = array(
        '#type' => 'select',
        '#multiple' => TRUE,
        '#title' => t('Categories'),
        '#default_value' => variable_get('sharethis_sharethis_this_category_types', array()),
        '#options' => $terms,
      );
    }
  }
  $form['where_to_sharethis_sharethis_this']['sharethis_teaser'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display in teaser view'),
    '#description' => t('If enabled, the ShareThis links will appear in node teasers. If disabled, they will only appear on the full node page.'),
    '#default_value' => variable_get('sharethis_teaser', 1),
  );
  $form['where_to_sharethis_sharethis_this']['sharethis_sharethis_this_where'] = array(
    '#type' => 'select',
    '#title' => t('Where to display'),
    '#description' => t('Select where you would like the ShareThis link to appear.'),
    '#default_value' => variable_get('sharethis_sharethis_this_where', 'links'),
    '#options' => array(
      'links' => t('Links'),
      'nodes' => t('Nodes'),
    ),
  );
  $form['where_to_sharethis_sharethis_this']['sharethis_sharethis_weight'] = array(
    '#type' => 'weight',
    '#delta' => 10,
    '#description' => t('Only applies when node type display is selected.'),
    '#title' => t('Weight'),
    '#default_value' => variable_get('sharethis_sharethis_weight', 0),
  );
  return system_settings_form($form);
}