You are here

function sexybookmarks_profiles_export_ui_form in Share Buttons, Related Posts, Content Analytics - Shareaholic 7.2

Same name and namespace in other branches
  1. 7 plugins/export_ui/sexybookmarks_profiles.inc \sexybookmarks_profiles_export_ui_form()

SexyBookmarks profiles settings form.

1 string reference to 'sexybookmarks_profiles_export_ui_form'
sexybookmarks_profiles.inc in plugins/export_ui/sexybookmarks_profiles.inc

File

plugins/export_ui/sexybookmarks_profiles.inc, line 29

Code

function sexybookmarks_profiles_export_ui_form(&$form, &$form_state) {
  drupal_add_library('system', 'farbtastic');
  drupal_add_js('jQuery(document).ready(jQuery("document").delegate("#replace_textfield_div","click", function(event){alert(jQuery(this).text());}));', array(
    'type' => 'inline',
    'scope' => 'footer',
    'weight' => 5,
  ));
  $config = $form_state['item']->config;
  $icons_proj_path = drupal_get_path('module', 'sexybookmarks');
  $icons_path = file_create_url("{$icons_proj_path}/images/glyphicons-halflings.png");
  $form['config'] = array(
    '#type' => 'container',
    '#tree' => TRUE,
    '#prefix' => '<div id="replace_config_div">',
    '#suffix' => '</div>',
  );
  drupal_add_css('.form-item-config-changethis {
     display:inline;margin-left: 20px;font-size: 15px;
    }
  ', 'inline');
  drupal_add_css('.form-item-config-classic-options {
     margin-left: 20px;font-size: 15px;
    }
  ', 'inline');
  drupal_add_css('[class^="icon-"] {
  background-image: url("' . $icons_path . '");
  background-repeat: no-repeat;
  display: inline-block;
  height: 14px;
  vertical-align: text-top;
  width: 14px;}.icon-ok {
    background-position: -288px 0;
}.icon-remove {
    background-position: -312px 0;
}
  ', 'inline');
  $form['config']['changethis'] = array(
    '#title' => t("Choose the bookmarks style"),
    '#theme' => 'formfactors_select',
    '#type' => 'radios',
    '#default_value' => isset($config['changethis']) ? $config['changethis'] : 1,
    '#parents' => array(
      'config',
      'changethis',
    ),
    '#options' => array(
      1 => 'Sexybookmarks',
      2 => 'Classic Bookmarks',
    ),
  );
  $form['config']['classic_options'] = array(
    '#title' => t("Choose the size"),
    '#theme' => 'classic_formfactor',
    '#type' => 'radios',
    '#default_value' => isset($config['classic_options']) ? $config['classic_options'] : 32,
    '#parents' => array(
      'config',
      'classic_options',
    ),
    '#options' => array(
      16 => '16X16',
      32 => '32X32',
    ),
    '#prefix' => '<div id="classic_div" style="margin-top: 30px;">',
    '#suffix' => '</div>',
    '#states' => array(
      'visible' => array(
        // action to take.
        ':input[name="config[changethis]"]' => array(
          'value' => 2,
        ),
      ),
    ),
  );
  $form['config']['service'] = array(
    '#type' => 'textarea',
    '#default_value' => isset($config['service']) ? $config['service'] : '5,7,88,2,3,257,74,52,207,191,236,54',
    '#theme' => 'sexybookmarks_services',
    '#prefix' => '<div id="replace_service_div">',
    '#suffix' => '</div>',
    '#states' => array(
      'visible' => array(
        // action to take.
        ':input[name="config[changethis]"]' => array(
          'value' => 1,
        ),
      ),
    ),
  );
  $form['config']['perfOptionSetting'] = array(
    '#theme' => 'perfoption',
    '#type' => 'radios',
    '#default_value' => isset($config['perfOptionSetting']) ? $config['perfOptionSetting'] : 1,
    '#options' => array(
      1 => 'Allow',
      0 => 'Disallow',
    ),
  );

  // Functionality settings.
  $form['config']['settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Functionality settings'),
    '#tree' => FALSE,
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#prefix' => '<div id="replace_settings_div">',
    '#suffix' => '</div>',
    '#states' => array(
      'visible' => array(
        // action to take.
        ':input[name="config[changethis]"]' => array(
          'value' => 1,
        ),
      ),
    ),
  );
  $form['config']['settings']['fbLikeButton'] = array(
    '#type' => 'radios',
    '#title' => t('Include Facebook Like button'),
    '#options' => array(
      1 => t('Yes'),
      0 => t('No'),
    ),
    '#default_value' => isset($config['fbLikeButton']) ? $config['fbLikeButton'] : 0,
    '#parents' => array(
      'config',
      'fbLikeButton',
    ),
  );
  $form['config']['settings']['fbButtonPos'] = array(
    '#type' => 'select',
    '#title' => t('Facebook Like button location'),
    '#options' => array(
      'bottom-left' => t('Bottom Left'),
      'bottom-right' => t('Bottom Right'),
      'top-left' => t('Top Left'),
      'top-right' => t('Top Right'),
    ),
    '#default_value' => isset($config['fbButtonPos']) ? $config['fbButtonPos'] : 'bottom-right',
    '#states' => array(
      'invisible' => array(
        'input[name="config[fbLikeButton]"]' => array(
          'checked' => FALSE,
        ),
      ),
    ),
    '#parents' => array(
      'config',
      'fbButtonPos',
    ),
  );
  $form['config']['settings']['dontShowShareCount'] = array(
    '#type' => 'radios',
    '#title' => t('Show Share counters'),
    '#options' => array(
      0 => t('Yes (recommended)'),
      1 => t('No'),
    ),
    '#default_value' => isset($config['dontShowShareCount']) ? $config['dontShowShareCount'] : 0,
    '#description' => t('For Facebook, Twitter and Delicious'),
    '#parents' => array(
      'config',
      'dontShowShareCount',
    ),
  );
  $form['config']['settings']['designer_toolTips'] = array(
    '#type' => 'radios',
    '#title' => t('Use Designer Tooltips'),
    '#options' => array(
      1 => t('Yes (recommended)'),
      0 => t('No'),
    ),
    '#default_value' => isset($config['designer_toolTips']) ? $config['designer_toolTips'] : 1,
    '#parents' => array(
      'config',
      'designer_toolTips',
    ),
  );
  $form['config']['settings']['tip_bg_color'] = array(
    '#type' => 'textfield',
    '#title' => t('Background Color for Tooltips'),
    '#size' => 7,
    '#maxlength' => 7,
    '#default_value' => isset($config['tip_bg_color']) ? $config['tip_bg_color'] : '#000000',
    '#states' => array(
      'invisible' => array(
        'input[name="config[designer_toolTips]"]' => array(
          'checked' => FALSE,
        ),
      ),
    ),
    '#parents' => array(
      'config',
      'tip_bg_color',
    ),
  );
  $form['config']['settings']['tip_text_color'] = array(
    '#type' => 'textfield',
    '#title' => t('Text Color for Tooltips'),
    '#size' => 7,
    '#maxlength' => 7,
    '#default_value' => isset($config['tip_text_color']) ? $config['tip_text_color'] : '#FFFFFF',
    '#states' => array(
      'invisible' => array(
        'input[name="config[designer_toolTips]"]' => array(
          'checked' => FALSE,
        ),
      ),
    ),
    '#parents' => array(
      'config',
      'tip_text_color',
    ),
  );
  $form['config']['settings']['rel'] = array(
    '#type' => 'radios',
    '#title' => t('Add Nofollow to Links'),
    '#options' => array(
      'nofollow' => t('Yes'),
      '' => t('No'),
    ),
    '#default_value' => isset($config['rel']) ? $config['rel'] : 'nofollow',
    '#parents' => array(
      'config',
      'rel',
    ),
  );
  $form['config']['settings']['target'] = array(
    '#type' => 'radios',
    '#title' => t('Open Links in New Window'),
    '#options' => array(
      '_blank' => t('Yes'),
      '_self' => t('No'),
    ),
    '#default_value' => isset($config['target']) ? $config['target'] : '_blank',
    '#parents' => array(
      'config',
      'target',
    ),
  );
  $form['config']['settings']['shrlink'] = array(
    '#type' => 'radios',
    '#title' => t('Show Shareaholic Link'),
    '#options' => array(
      1 => t('Yes'),
      0 => t('No'),
    ),
    '#default_value' => isset($config['shrlink']) ? $config['shrlink'] : 1,
    '#parents' => array(
      'config',
      'shrlink',
    ),
  );
  $form['config']['settings']['shortener'] = array(
    '#type' => 'select',
    '#title' => t('Which URL Shortener'),
    '#empty_value' => 'none',
    '#options' => array(
      'bitly' => t('bit.ly'),
      'google' => t('goo.gl'),
      'jmp' => t('jmp.li'),
      'supr' => t('su.pr'),
      'tinyurl' => t('tinyurl.com'),
    ),
    '#default_value' => isset($config['shortener']) ? $config['shortener'] : 'google',
    '#parents' => array(
      'config',
      'shortener',
    ),
  );

  // Twitter specific settings.
  $form['config']['twitter'] = array(
    '#type' => 'fieldset',
    '#title' => t('Twitter settings'),
    '#tree' => FALSE,
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#prefix' => '<div id="replace_twitter_div">',
    '#suffix' => '</div>',
    '#states' => array(
      'visible' => array(
        // action to take.
        ':input[name="config[changethis]"]' => array(
          'value' => 1,
        ),
      ),
    ),
  );
  $form['config']['twitter']['twitter_template'] = array(
    '#type' => 'textfield',
    '#title' => t('Configure Custom Tweet Template'),
    '#default_value' => isset($config['twitter_template']) ? $config['twitter_template'] : '${title} - ${short_link} via @Shareaholic',
    '#description' => '<strong>' . t('Configuration Instructions') . ':</strong><br />' . '<em>' . t('Using the strings ${title} and ${short_link} you can fully customize your tweet output.') . '</em>' . '<p>' . '  <strong>' . t('Example Configurations') . ':</strong><br />' . '  <em>' . t('${title} - ${short_link} (via @Shareaholic)') . '</em><br />' . '  ' . t('or') . '<br />' . '  <em>' . t('RT @Shareaholic: ${title} - ${short_link}') . '</em>' . '</p>',
    '#parents' => array(
      'config',
      'twitter_template',
    ),
  );

  // Aesthetic settings.
  $form['config']['aesthetics'] = array(
    '#type' => 'fieldset',
    '#title' => t('Aesthetic settings'),
    '#tree' => FALSE,
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#prefix' => '<div id="replace_aesthetics_div">',
    '#suffix' => '</div>',
    '#states' => array(
      'visible' => array(
        // action to take.
        ':input[name="config[changethis]"]' => array(
          'value' => 1,
        ),
      ),
    ),
  );
  $form['config']['aesthetics']['expand'] = array(
    '#type' => 'radios',
    '#title' => t('Animate-expand multi-lined bookmarks'),
    '#options' => array(
      1 => t('Yes'),
      0 => t('No'),
    ),
    '#default_value' => isset($config['expand']) ? $config['expand'] : 1,
    '#parents' => array(
      'config',
      'expand',
    ),
  );
  $form['config']['aesthetics']['positioning'] = array(
    '#type' => 'radios',
    '#title' => t('Auto-space/center the bookmarks'),
    '#options' => array(
      'spaced' => t('Space'),
      'center' => t('Center'),
      'no' => t('No'),
    ),
    '#default_value' => isset($config['spaced']) && $config['spaced'] ? 'spaced' : (isset($config['center']) && $config['center'] ? 'center' : 'no'),
    '#parents' => array(
      'config',
      'positioning',
    ),
  );
}