You are here

function social_content_instagram_settings_form in Social Content 7

1 string reference to 'social_content_instagram_settings_form'
social_content_instagram_social_content_info in modules/instagram/social_content_instagram.module

File

modules/instagram/social_content_instagram.module, line 65
Social Content: Instagram module.

Code

function social_content_instagram_settings_form(&$form, $social_content_type, $settings) {
  $token_generator_link = l(t('Instagram access token generator'), 'admin/config/services/social-content/' . $social_content_type['name'] . '/access_token_generator');
  $form['access_token'] = array(
    '#type' => 'textfield',
    '#title' => t('Access Token'),
    '#default_value' => $settings['access_token'],
    '#required' => TRUE,
    '#description' => t('You can use the !token_generator_link to help you obtain this.', array(
      '!token_generator_link' => $token_generator_link,
    )),
  );
  if ($social_content_type['name'] == 'instagram_account') {
    $example_url = 'https://api.instagram.com/v1/users/search?q=username={YOUR_USERNAME}&access_token=';
    if (empty($settings['access_token'])) {
      $example_url .= '{GENERATED_ACCESS_TOKEN}';
    }
    else {
      $example_url .= $settings['access_token'];
    }
    $form['user_id'] = array(
      '#type' => 'textfield',
      '#title' => t('Instagram User ID'),
      '#description' => t('Visit !url to obtain one.', array(
        '!url' => $example_url,
      )),
      '#default_value' => $settings['user_id'],
    );
  }
  elseif ($social_content_type['name'] == 'instagram_hashtag') {
    $form['hashtags'] = array(
      '#type' => 'textfield',
      '#title' => t('Hashtags'),
      '#description' => t('Without the leading #. You can define multiple hashtags separated by space.'),
      '#default_value' => $settings['hashtags'],
    );
  }
  $form['api_url'] = array(
    '#type' => 'textfield',
    '#title' => t('API URL'),
    '#description' => t('Do not include ending slash'),
    '#default_value' => $settings['api_url'],
  );
  $form['min_resolution'] = array(
    '#type' => 'textfield',
    '#title' => t('Minimum image resolution'),
    '#description' => t('Only posts that have images that meet the minimum image resolution will be imported. WIDTHxHEIGHT'),
    '#default_value' => $settings['min_resolution'],
  );
}