You are here

public function SocialContentInstagram::instanceSettingsForm in Social Content 7.2

Instance settings form.

Return value

array Any instance settings that will be included on all instance forms for the current global.

Overrides SocialContent::instanceSettingsForm

File

modules/instagram/social_content_instagram.class.inc, line 152
Social Content Instagram class.

Class

SocialContentInstagram
@file Social Content Instagram class.

Code

public function instanceSettingsForm() {
  $settings = $this->settings['instance'];
  $form = parent::instanceSettingsForm($settings);
  $form['type'] = array(
    '#type' => 'select',
    '#title' => t('Import'),
    '#options' => $this
      ->getImportTypes(),
    '#description' => t('What should be imported.'),
    '#default_value' => isset($settings['type']) ? $settings['type'] : NULL,
    '#required' => TRUE,
    '#attributes' => array(
      'class' => array(
        'social-content-instagram-type',
      ),
    ),
  );
  $form['user_id'] = array(
    '#type' => 'textfield',
    '#title' => t('Instagram User ID'),
    '#description' => t("The Instagram user id to pull the statuses from. E.g. '235448524'. To get it, see !link.", array(
      '!link' => l('youtu.be/8JqdvQKfB3s', 'https://youtu.be/8JqdvQKfB3s'),
    )),
    '#default_value' => isset($settings['user_id']) ? $settings['user_id'] : NULL,
    '#states' => array(
      'visible' => array(
        '.social-content-instagram-type' => array(
          'value' => 'account',
        ),
      ),
    ),
    '#element_validate' => array(
      'element_validate_number',
    ),
  );
  $form['hashtag'] = array(
    '#type' => 'textfield',
    '#title' => t('Instagram hashtag'),
    '#description' => t("The Instagram #hashtag to pull the statuses from. Do not put a leading '#'. Note that to import public content a non-sandbox app is required. See <a href='https://www.instagram.com/developer/sandbox'>instagram.com/developer/sandbox</a>."),
    '#default_value' => isset($settings['hashtag']) ? $settings['hashtag'] : NULL,
    '#states' => array(
      'visible' => array(
        '.social-content-instagram-type' => array(
          'value' => 'hashtag',
        ),
      ),
    ),
  );
  $form['min_resolution'] = array(
    '#type' => 'textfield',
    '#title' => t('Minimum image resolution'),
    '#description' => t('Only posts that have images that meet the minimum image resolution (in {width}x{height} format) will be imported.'),
    '#default_value' => isset($settings['min_resolution']) ? $settings['min_resolution'] : NULL,
  );
  $form['include'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Only include'),
    '#options' => array(
      'image' => t('Image'),
      'video' => t('Video'),
    ),
    '#description' => t('Restrict what type of Instagram posts should be imported. Leave empty to import all post types.'),
    '#default_value' => isset($settings['include']) ? $settings['include'] : array(),
  );
  return $form;
}