You are here

function sharebar_settings in ShareBar 7.2

Same name and namespace in other branches
  1. 6 sharebar.admin.inc \sharebar_settings()
  2. 7 sharebar.admin.inc \sharebar_settings()

Form builder: Configure the sharebar system.

1 string reference to 'sharebar_settings'
sharebar_menu in ./sharebar.module
Implements hook_menu().

File

./sharebar.admin.inc, line 234
Admin page callbacks for the block module.

Code

function sharebar_settings() {
  $path = libraries_get_path('colorpicker');
  drupal_add_css($path . '/css/colorpicker.css');
  drupal_add_js($path . '/js/colorpicker.js');
  drupal_add_js(drupal_get_path('module', 'sharebar') . '/js/colorpicker.js');
  $form['buttonsset'] = array(
    '#type' => 'fieldset',
    '#title' => t('Buttons'),
    '#description' => t('The following buttons are added by default in sharebar. You might wanna clear the cache after Add/edit/delete operation on buttons if changes not being reflected.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['buttonsset']['buttons'] = array(
    '#theme' => 'sharebar_buttons_table',
    '#weight' => 0,
  );

  // Display options.
  $form['displayoptions'] = array(
    '#type' => 'fieldset',
    '#weight' => 2,
    '#title' => t('Display options'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['displayoptions']['sharebar_bar_horizontal'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display horizontal Sharebar if the page is resized to less than 1000px?'),
    '#default_value' => variable_get('sharebar_bar_horizontal', TRUE),
  );
  $form['displayoptions']['sharebar_bar_onblock'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display sharebar as a block.'),
    '#default_value' => variable_get('sharebar_bar_onblock', TRUE),
  );
  $form['displayoptions']['sharebar_bar_credit'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display credit link back to the Sharebar plugin? If disabled, please consider donating.'),
    '#default_value' => variable_get('sharebar_bar_credit', TRUE),
  );
  $form['displayoptions']['sharebar_bar_id'] = array(
    '#type' => 'textfield',
    '#title' => t('Custom CSS Container when displayed in any region'),
    '#description' => t('Only id selector is supported.'),
    '#size' => 10,
    '#default_value' => variable_get('sharebar_bar_id', 'sharebar'),
  );
  $form['displayoptions']['sharebar_bar_idhorizontal'] = array(
    '#type' => 'textfield',
    '#title' => t('Custom CSS Container when displayed horizontally'),
    '#description' => t('Only id selector is supported.'),
    '#size' => 10,
    '#default_value' => variable_get('sharebar_bar_idhorizontal', 'sharebarx'),
    '#states' => array(
      'visible' => array(
        ':input[name="sharebar_bar_horizontal"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $form['displayoptions']['sharebar_bar_toptoffset'] = array(
    '#type' => 'textfield',
    '#title' => t('Top Offset'),
    '#size' => 10,
    '#default_value' => variable_get('sharebar_bar_toptoffset', 0),
  );
  $form['displayoptions']['sharebar_bar_position'] = array(
    '#type' => 'select',
    '#title' => t('Sharebar Position'),
    '#description' => t('Respective to the region, sharebar is being displayed in.'),
    '#default_value' => variable_get('sharebar_bar_position', 'none'),
    '#options' => array(
      'none' => 'None',
      'left' => 'Left',
      'right' => 'Right',
    ),
  );
  $form['displayoptions']['sharebar_bar_leftoffset'] = array(
    '#type' => 'textfield',
    '#title' => t('Left Offset'),
    '#description' => t('Used when positioned to left.'),
    '#size' => 10,
    '#default_value' => variable_get('sharebar_bar_leftoffset', 10),
  );
  $form['displayoptions']['sharebar_bar_rightoffset'] = array(
    '#type' => 'textfield',
    '#title' => t('Right Offset'),
    '#description' => t('Used when positioned to right.'),
    '#size' => 10,
    '#default_value' => variable_get('sharebar_bar_rightoffset', 10),
  );
  $form['displayoptions']['sharebar_bar_width'] = array(
    '#type' => 'textfield',
    '#title' => t('Minimum width in pixels required to show vertical Sharebar to the left of post'),
    '#size' => 10,
    '#default_value' => variable_get('sharebar_bar_width', 1000),
    '#required' => TRUE,
  );
  $form['displayoptions']['sharebar_info'] = array(
    '#markup' => t('<b>Note:</b> "Display sharebar as a block" option must always be checked/enabled.'),
  );

  // Customize.
  $sitename = variable_get('site_name', '');
  $form['customize'] = array(
    '#type' => 'fieldset',
    '#weight' => 3,
    '#title' => t('Customize'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['customize']['sharebar_bar_swidth'] = array(
    '#type' => 'textfield',
    '#title' => t('Sharebar Width'),
    '#size' => 10,
    '#default_value' => variable_get('sharebar_bar_swidth', 75),
  );
  $form['customize']['sharebar_bar_twitter_username'] = array(
    '#type' => 'textfield',
    '#title' => t('Twitter Username'),
    '#size' => 10,
    '#default_value' => variable_get('sharebar_bar_twitter_username', $sitename),
  );
  $form['customize']['sharebar_bar_background'] = array(
    '#type' => 'textfield',
    '#title' => t('Sharebar Background Color'),
    '#size' => 10,
    '#default_value' => variable_get('sharebar_bar_background', 'FFFFFF'),
  );
  $form['customize']['sharebar_bar_border_style'] = array(
    '#type' => 'select',
    '#title' => t('Sharebar Border Style'),
    '#default_value' => variable_get('sharebar_bar_border_style', 'solid'),
    '#options' => array(
      'none' => 'none',
      'dotted' => 'dotted',
      'dashed' => 'dashed',
      'solid' => 'solid',
      'double' => 'double',
      'groove' => 'groove',
      'ridge' => 'ridge',
      'inset' => 'inset',
      'outset' => 'outset',
    ),
  );
  $form['customize']['sharebar_bar_border_width'] = array(
    '#type' => 'textfield',
    '#title' => t('Sharebar Border Width'),
    '#size' => 10,
    '#default_value' => variable_get('sharebar_bar_border_width', '1px'),
  );
  $form['customize']['sharebar_bar_border'] = array(
    '#type' => 'textfield',
    '#title' => t('Sharebar Border Color'),
    '#size' => 10,
    '#default_value' => variable_get('sharebar_bar_border', 'CCCCCC'),
  );
  return system_settings_form($form);
}