You are here

function facebookshare_admin_settings in Facebook Share 7

Same name and namespace in other branches
  1. 6.3 facebookshare.admin.inc \facebookshare_admin_settings()
  2. 6 facebookshare.admin.inc \facebookshare_admin_settings()

Form for settings for the Facebook Share module

1 string reference to 'facebookshare_admin_settings'
facebookshare_menu in ./facebookshare.module
Implements hook_menu()

File

./facebookshare.admin.inc, line 10
Administration settings form area for Facebook Share module

Code

function facebookshare_admin_settings($form, &$form_state) {
  drupal_add_css(drupal_get_path('module', 'facebookshare') . '/facebookshare.admin.css');
  $form['facebookshare_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Content types'),
    '#description' => t('Which content types to apply the Facebook Share button to.'),
    '#options' => node_type_get_names(),
    '#default_value' => variable_get('facebookshare_types', array()),
  );
  $form['facebookshare_location'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Location'),
    '#description' => t('Where to show the Facebook Share button.'),
    '#options' => array(
      'content' => t('Full view'),
      'teasers' => t('Teasers'),
    ),
    '#default_value' => variable_get('facebookshare_location', array()),
  );
  $form['facebookshare_weight'] = array(
    '#type' => 'textfield',
    '#title' => t('Weight'),
    '#description' => t('The weight of which the Facebook widget should appear on the content.'),
    '#default_value' => variable_get('facebookshare_weight', '-10'),
    '#size' => 5,
  );
  $sizes = array(
    'box_count' => '',
    'button_count' => '',
    'button' => '',
    'icon_link' => '',
    'icon' => '',
  );
  foreach ($sizes as $size => $button) {
    $sizes[$size] = '<img src="' . base_path() . drupal_get_path('module', 'facebookshare') . '/images/' . $size . '.png">';
  }
  $form['facebookshare_size'] = array(
    '#type' => 'radios',
    '#title' => t('Button size'),
    '#required' => TRUE,
    '#description' => t('What kind of button to show.'),
    '#options' => $sizes,
    '#default_value' => variable_get('facebookshare_size', ''),
  );
  $form['facebookshare_text'] = array(
    '#type' => 'textfield',
    '#title' => t('Share button text'),
    '#default_value' => variable_get('facebookshare_text'),
    '#description' => t('Leave blank for default "Share" text'),
  );
  return system_settings_form($form);
}