tweetbutton.admin.inc 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <?php
  2. function tweetbutton_admin_settings() {
  3. $form = array();
  4. $form['button'] = array(
  5. '#type' => 'fieldset',
  6. '#title' => t('Default settings for tweetbutton'),
  7. );
  8. $form['button']['tweetbutton_button'] = array(
  9. '#type' => 'select',
  10. '#options' => array(
  11. 'vertical' => t('Vertical Count'),
  12. 'horizontal' => t('Horizontal Count'),
  13. 'none' => t('No count'),
  14. ),
  15. '#default_value' => variable_get('tweetbutton_button', 'vertical'),
  16. '#id' => 'tweetbutton-button',
  17. );
  18. $form['button']['tweetbutton_tweet_text'] = array(
  19. '#type' => 'textfield',
  20. '#title' => t('Tweet Text'),
  21. '#default_value' => variable_get('tweetbutton_tweet_text'),
  22. '#description' => t('Tweet text to use as a default text, if no values are passed, leave this to blank to use page title as tweet text.')
  23. );
  24. $form['button']['tokens'] = array(
  25. '#token_types' => array('node'),
  26. '#theme' => 'token_tree',
  27. );
  28. $form['button']['tweetbutton_size'] = array(
  29. '#title' => t('Tweetbutton size'),
  30. '#type' => 'select',
  31. '#options' => array(
  32. 'medium' => t('Medium'),
  33. 'large' => t('Large'),
  34. ),
  35. '#default_value' => variable_get('tweetbutton_size'),
  36. );
  37. $form['button']['tweetbutton_hashtags'] = array(
  38. '#title' => t('Hashtags'),
  39. '#type' => 'textfield',
  40. '#default_value' => variable_get('tweetbutton_hashtags'),
  41. '#description' => t('Comma separated hashtags to be used in every tweet'),
  42. );
  43. $form['button']['tweetbutton_language'] = array(
  44. '#title' => t('Language'),
  45. '#description' => t('This is the language that the button will render in on your website. People will see the Tweet dialog in their selected language for Twitter.com.'),
  46. '#type' => 'select',
  47. '#options' => array(
  48. 'en' => t('English'),
  49. 'fr' => t('French'),
  50. 'de' => t('German'),
  51. 'es' => t('Spanish'),
  52. 'ja' => t('Japanese'),
  53. 'auto' => t('Automatic'),
  54. ),
  55. '#default_value' => variable_get('tweetbutton_language'),
  56. );
  57. if (module_exists('shorten')) {
  58. $services = array();
  59. $services[0] = t('Use t.co twitter default url shortener');
  60. $all_services = module_invoke_all('shorten_service');
  61. foreach (array_keys($all_services) as $value) {
  62. $services[$value] = $value;
  63. }
  64. $form['button']['tweetbutton_shorten_service'] = array(
  65. '#title' => t('Shorten service to use to add custom url'),
  66. '#type' => 'select',
  67. '#options' => $services,
  68. '#default_value' => variable_get('tweetbutton_shorten_service', 0),
  69. );
  70. }
  71. $form['button']['follow'] = array(
  72. '#type' => 'fieldset',
  73. '#title' => t('Recommend people to follow'),
  74. );
  75. $form['button']['follow']['tweetbutton_account'] = array(
  76. '#type' => 'textfield',
  77. '#title' => t('Twitter account to follow'),
  78. '#description' => t('This user will be @mentioned in the suggested. Will be used as default if tweetbutton fields author twitter account is not set'),
  79. '#default_value' => variable_get('tweetbutton_account'),
  80. '#id' => 'tweetbutton-account',
  81. );
  82. $form['button']['follow']['tweetbutton_rel_account_name'] = array(
  83. '#type' => 'textfield',
  84. '#title' => t('Related Account'),
  85. '#default_value' => variable_get('tweetbutton_rel_account_name'),
  86. '#description' => t('This should be site default twitter account'),
  87. );
  88. $form['button']['follow']['tweetbutton_rel_account_description'] = array(
  89. '#type' => 'textfield',
  90. '#title' => t('Related Account Description'),
  91. '#default_value' => variable_get('tweetbutton_rel_account_description'),
  92. );
  93. $form['follow_button'] = array(
  94. '#type' => 'fieldset',
  95. '#title' => t('Follow button settings'),
  96. );
  97. $form['follow_button']['tweetbutton_follow_show_count'] = array(
  98. '#type' => 'checkbox',
  99. '#title' => t('Show follow count'),
  100. '#default_value' => variable_get('tweetbutton_follow_show_count', TRUE),
  101. );
  102. $form['follow_button']['tweetbutton_follow_screen_name'] = array(
  103. '#type' => 'textfield',
  104. '#title' => t('Screen name to follow'),
  105. '#default_value' => variable_get('tweetbutton_follow_screen_name'),
  106. );
  107. $form['follow_button']['tweetbutton_follow_size'] = array(
  108. '#title' => t('Tweetbutton size'),
  109. '#type' => 'select',
  110. '#options' => array(
  111. 'medium' => t('Medium'),
  112. 'large' => t('Large'),
  113. ),
  114. '#default_value' => variable_get('tweetbutton_follow_size'),
  115. );
  116. return system_settings_form($form);
  117. }