You are here

function jquery_social_stream_twitter_form in jQuery social stream 8

Same name and namespace in other branches
  1. 8.2 jquery_social_stream.module \jquery_social_stream_twitter_form()
  2. 7.2 jquery_social_stream.module \jquery_social_stream_twitter_form()
  3. 7 jquery_social_stream.module \jquery_social_stream_twitter_form()

Twitter settings form.

File

./jquery_social_stream.module, line 384
Code for the Campaign social media module.

Code

function jquery_social_stream_twitter_form($conf) {
  $form = array();
  $api_key = \Drupal::config('jquery_social_stream.settings')
    ->get('twitter_api_key');
  if (!$api_key) {
    $form['#description'] = t('Please note you must enter Twitter API keys at <a href="/admin/config/services/jquery-social-stream">admin/config/services/jquery-social-stream</a> to display Twitter feed');
  }
  $id_description = '<p>Twitter has 3 different feed options:</p>
<dl>
<dt>Tweets from a specific user name</dt>
<dd>Enter the required user name (minus the "@" symbol) (e.g. <em>designchemical</em>)</dd>
<dt>Tweets from a list</dt>
<dd>To show a list enter "/" followed by the list ID you want to display (e.g. <em>/9927875</em>)</dd>
<dt>Tweets from a search</dt>
<dd>Enter "#" followed by the search term (e.g. <em>#designchemical</em>)</dd></dl>';
  _jquery_social_stream_settings_text($form, $conf, 'id', 'Twitter ID', $id_description, '', 512);
  _jquery_social_stream_settings_select($form, $conf, 'retweets', 'Retweets', 'Select whether to  to include retweets.', array(
    1 => t('Yes'),
    0 => t('No'),
  ), 0);
  _jquery_social_stream_settings_select($form, $conf, 'replies', 'Replies', 'Select whether to  to include replies.', array(
    1 => t('Yes'),
    0 => t('No'),
  ), 0);
  _jquery_social_stream_settings_text($form, $conf, 'intro', 'Intro', 'Feed item intro text.', t('Tweeted'));
  _jquery_social_stream_settings_text($form, $conf, 'search', 'Search', 'Search item intro text.', t('Tweeted'));
  _jquery_social_stream_settings_text($form, $conf, 'out', 'Output', 'Stream item output: content blocks & order. Available options: intro, text, user, share.', 'intro,text,user,share');
  $images_options = array(
    '' => 'None',
    'thumb' => 'Thumb (150x150 px)',
    'small' => 'Small (340x150 px)',
    'medium' => 'Medium (600x264 px)',
    'large' => 'Large (768x346 px)',
  );
  _jquery_social_stream_settings_select($form, $conf, 'images', 'Images', 'Option to show twitter images. Select one of the sizes to include the image when available or <em>None</em> to exclude images.', $images_options, '');
  $form['icon'] = array(
    '#type' => 'value',
    '#value' => 'twitter.png',
  );
  $form['url'] = array(
    '#type' => 'value',
    '#value' => 'js/jquery_social_stream/twitter',
  );
  return $form;
}