You are here

function jquery_social_stream_admin_form in jQuery social stream 7

Same name and namespace in other branches
  1. 7.2 jquery_social_stream.admin.inc \jquery_social_stream_admin_form()

Admin settings form.

1 string reference to 'jquery_social_stream_admin_form'
jquery_social_stream_menu in ./jquery_social_stream.module
Implements hook_menu().

File

./jquery_social_stream.admin.inc, line 11
Admin functions for Campaign Social Media module.

Code

function jquery_social_stream_admin_form($form, &$form_state) {
  $form = array();

  // Twitter.
  $form['twitter'] = array(
    '#type' => 'fieldset',
    '#tree' => FALSE,
    '#title' => t('Twitter settings'),
  );
  $form['twitter']['jquery_social_stream_twitter_api_key'] = array(
    '#type' => 'textfield',
    '#title' => t('Twitter API Key'),
    '#default_value' => variable_get('jquery_social_stream_twitter_api_key', ''),
  );
  $form['twitter']['jquery_social_stream_twitter_api_secret'] = array(
    '#type' => 'textfield',
    '#title' => t('Twitter API Secret'),
    '#default_value' => variable_get('jquery_social_stream_twitter_api_secret', ''),
  );
  $form['twitter']['jquery_social_stream_twitter_access_token'] = array(
    '#type' => 'textfield',
    '#title' => t('Twitter Access Token'),
    '#default_value' => variable_get('jquery_social_stream_twitter_access_token', ''),
  );
  $form['twitter']['jquery_social_stream_twitter_access_token_secret'] = array(
    '#type' => 'textfield',
    '#title' => t('Twitter Access Token Secret'),
    '#default_value' => variable_get('jquery_social_stream_twitter_access_token_secret', ''),
  );

  // Google +.
  $form['google'] = array(
    '#type' => 'fieldset',
    '#tree' => FALSE,
    '#title' => t('Google +1 settings'),
  );
  $form['google']['jquery_social_stream_google_key'] = array(
    '#type' => 'textfield',
    '#title' => t('Google +1 API Key'),
    '#default_value' => variable_get('jquery_social_stream_google_key', ''),
  );

  // Instagram.
  $form['instagram'] = array(
    '#type' => 'fieldset',
    '#tree' => FALSE,
    '#title' => t('Instagram settings'),
  );
  $form['instagram']['jquery_social_stream_instagram_access_token'] = array(
    '#type' => 'textfield',
    '#title' => t('Instagram Access Token'),
    '#description' => t('Access token created from the authorisation of your OAuth Client'),
    '#default_value' => variable_get('jquery_social_stream_instagram_access_token', ''),
  );
  $form['instagram']['jquery_social_stream_instagram_redirect_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Instagram Redirect URL'),
    '#description' => t('The URL entered as the redirect URL when registering your new OAuth Client in the Instagram API setup'),
    '#default_value' => variable_get('jquery_social_stream_instagram_redirect_url', ''),
  );
  $form['instagram']['jquery_social_stream_instagram_client_id'] = array(
    '#type' => 'textfield',
    '#title' => t('Instagram Client ID'),
    '#description' => t('Client ID for API created after registering your new OAuth Client in the instagram API setup'),
    '#default_value' => variable_get('jquery_social_stream_instagram_client_id', ''),
  );
  $doc_file = libraries_get_path('jquery-social-stream') . '/index.html';
  if (file_exists(DRUPAL_ROOT . '/' . $doc_file)) {
    $form['google']['#description'] = t('See section <em>Creating Your Own Google API Key</em> in <a href="/!path">jQuery Social Stream plugin documentation</a> for details.', array(
      '!path' => $doc_file,
    ));
    $form['instagram']['#description'] = t('See section <em>Creating Your Own Instagram API Client ID</em> in <a href="/!path">jQuery Social Stream plugin documentation</a> for details.', array(
      '!path' => $doc_file,
    ));
  }
  else {
    $form['google']['#description'] = t('See section <em>Creating Your Own Google API Key</em> in jQuery Social Stream plugin documentation for details (file <em>index.html</em> in plugin root directory).');
    $form['instagram']['#description'] = t('See section <em>Creating Your Own Instagram API Client ID</em> in jQuery Social Stream plugin documentation for details (file <em>index.html</em> in plugin root directory).');
  }
  return system_settings_form($form);
}