You are here

jquery_social_stream.admin.inc in jQuery social stream 7

Same filename and directory in other branches
  1. 7.2 jquery_social_stream.admin.inc

Admin functions for Campaign Social Media module.

File

jquery_social_stream.admin.inc
View source
<?php

/**
 * @file
 * Admin functions for Campaign Social Media module.
 */

/**
 * Admin settings form.
 */
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);
}

Functions

Namesort descending Description
jquery_social_stream_admin_form Admin settings form.