You are here

function sharemessage_addthis_settings in Share Message 7

Implements hook_sytem_settings().

1 string reference to 'sharemessage_addthis_settings'
sharemessage_menu in ./sharemessage.module
Implements hook_menu().

File

./sharemessage.module, line 447
New Sharing Module.

Code

function sharemessage_addthis_settings($form, $form_state) {
  if (module_exists('shariff')) {
    $form['sharemessage_default_type'] = [
      '#type' => 'radios',
      '#title' => t('Type'),
      '#options' => array(
        'addthis' => 'Addthis',
        'shariff' => 'Shariff',
      ),
      '#default_value' => variable_get('sharemessage_default_type', 'addthis'),
      '#description' => t('The settings below are only for Addthis sharing, the shariff settings are on the <a href="@shariff_settings_url">shariff settings page</a>.', array(
        '@shariff_settings_url' => url('admin/config/services/shariff'),
      )),
    ];
  }
  $form['sharemessage_addthis_profile_id'] = array(
    '#title' => t('AddThis Profile ID'),
    '#type' => 'textfield',
    '#default_value' => variable_get('sharemessage_addthis_profile_id', ''),
  );
  $form['sharemessage_default_services'] = array(
    '#title' => t('Default visible services'),
    '#type' => 'select',
    '#multiple' => TRUE,
    '#options' => sharemessage_get_addthis_services(),
    '#default_value' => variable_get('sharemessage_default_services', array()),
    '#size' => 10,
  );
  $form['sharemessage_default_additional_services'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show additional services button'),
    '#default_value' => variable_get('sharemessage_default_additional_services', TRUE),
  );
  $form['sharemessage_default_counter'] = array(
    '#type' => 'select',
    '#title' => t('Show Addthis counter'),
    '#empty_option' => t('No'),
    '#options' => array(
      'addthis_pill_style' => t('Pill style'),
      'addthis_bubble_style' => t('Bubble style'),
    ),
    '#default_value' => variable_get('sharemessage_default_counter', FALSE),
  );
  $form['sharemessage_default_icon_style'] = array(
    '#title' => t('Default icon style'),
    '#type' => 'radios',
    '#options' => sharemessage_get_sharewidget_options(),
    '#default_value' => variable_get('sharemessage_default_icon_style', 'addthis_16x16_style'),
  );
  $form['sharemessage_message_enforcement'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow to enforce share messages'),
    '#description' => t('This will enforce loading of a sharemessage if the ?smid argument is present in an URL. If something else on your site is using this argument, disable this this option.'),
    '#default_value' => variable_get('sharemessage_message_enforcement', TRUE),
  );
  $form['sharemessage_local_services_definition'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use local service definitions file'),
    '#description' => t('Check this if you are behind a firewall and the module cannot access the services definition at http://cache.addthiscdn.com/services/v1/sharing.en.json.'),
    '#default_value' => variable_get('sharemessage_local_services_definition', FALSE),
  );
  $form['sharemessage_shared_video_width'] = array(
    '#title' => t('Video width'),
    '#description' => t('The width of the player when sharing a video.'),
    '#type' => 'textfield',
    '#default_value' => variable_get('sharemessage_shared_video_width', 360),
  );
  $form['sharemessage_shared_video_height'] = array(
    '#title' => t('Video height'),
    '#description' => t('The height of the player when sharing a video.'),
    '#type' => 'textfield',
    '#default_value' => variable_get('sharemessage_shared_video_height', 270),
  );
  $form['sharemessage_add_twitter_card'] = array(
    '#type' => 'checkbox',
    '#title' => t("Add meta tags for twitter's summary card with large image"),
    '#description' => t('Enables sharing of images on twitter, check <a href="@url">this</a> for more information.', array(
      '@url' => 'https://dev.twitter.com/cards/types/summary-large-image',
    )),
    '#default_value' => variable_get('sharemessage_add_twitter_card', FALSE),
    '#element_validate' => array(
      'sharemessage_validate_twitter_card_requirements',
    ),
  );
  $form['sharemessage_twitter_user'] = array(
    '#title' => t('Twitter account username'),
    '#description' => t('This is required when enabling the meta tags for twitter cards above.'),
    '#type' => 'textfield',
    '#default_value' => variable_get('sharemessage_twitter_user', ''),
    '#states' => array(
      'visible' => array(
        ':input[name="sharemessage_add_twitter_card"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  return system_settings_form($form);
}