You are here

public function OAuthHTTPFetcher::configForm in Feeds OAuth 7

Same name and namespace in other branches
  1. 6 OAuthHTTPFetcher.inc \OAuthHTTPFetcher::configForm()

Add form options.

1 call to OAuthHTTPFetcher::configForm()
OAuth2HTTPSFetcher::configForm in ./OAuth2HTTPSFetcher.inc
Add form options.
1 method overrides OAuthHTTPFetcher::configForm()
OAuth2HTTPSFetcher::configForm in ./OAuth2HTTPSFetcher.inc
Add form options.

File

./OAuthHTTPFetcher.inc, line 148
Definition of the import batch object created on the fetching stage by OAuthHTTPFetcher.

Class

OAuthHTTPFetcher
Support OAuth authentication.

Code

public function configForm(&$form_state) {
  $form = parent::configForm($form_state);
  $form['use_pubsubhubbub'] = array(
    '#type' => 'value',
    '#value' => FALSE,
  );
  $form['authenticator'] = array(
    '#type' => 'select',
    '#title' => t('OAuth authenticator'),
    '#default_value' => $this->config['authenticator'],
    '#options' => module_invoke_all('feeds_oauth_authenticator'),
    '#description' => t('Choose the authentication module that provides the needed OAuth tokens.'),
  );
  $form['uid'] = array(
    '#type' => 'select',
    '#title' => t('Authenticating user'),
    '#description' => t('OAuth access tokens will be retrieved for this user when fetching the feed.
                           Select "- None -" to use the source node\'s owner (in the case of using a source node)
                           or the current user (in the case of standalone source form).'),
    '#default_value' => $this->config['uid'],
    '#options' => array(
      NULL => t('- None -'),
    ) + db_query("SELECT uid, name FROM {users} WHERE status = 1 and uid != 0")
      ->fetchAllKeyed(),
  );
  $form['site_id'] = array(
    '#type' => 'textfield',
    '#title' => t('Site identifier'),
    '#default_value' => $this->config['site_id'],
    '#description' => t('Internal identifier for this connection. Should only contain alphanumeric characters and hyphens. For the current configuration, callback URL will be: <code class="site-id">%url</code>', array(
      '%url' => url('feeds/oauth' . ($this->two ? '2' : '') . '/callback/' . $this->config['site_id'], array(
        'absolute' => TRUE,
      )),
    )),
    '#required' => TRUE,
    '#attached' => array(
      'js' => array(
        drupal_get_path('module', 'feeds_oauth') . '/feeds_oauth.js',
      ),
    ),
  );
  $form['consumer_key'] = array(
    '#type' => 'textfield',
    '#title' => t('Consumer key'),
    '#default_value' => $this->config['consumer_key'],
    '#required' => TRUE,
  );
  $form['consumer_secret'] = array(
    '#type' => 'textfield',
    '#title' => t('Consumer secret'),
    '#default_value' => $this->config['consumer_secret'],
    '#required' => TRUE,
  );
  if (!$this->two) {
    $form['request_token_url'] = array(
      '#type' => 'textfield',
      '#title' => t('Request token URL'),
      '#default_value' => $this->config['request_token_url'],
      '#required' => TRUE,
    );
  }
  $form['access_token_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Access token URL'),
    '#default_value' => $this->config['access_token_url'],
    '#required' => TRUE,
  );
  $form['authorize_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Authorize URL'),
    '#default_value' => $this->config['authorize_url'],
    '#required' => TRUE,
  );
  $form['method'] = array(
    '#type' => 'select',
    '#title' => t('Method'),
    '#default_value' => $this->config['method'],
    '#options' => array(
      'get' => 'GET',
      'post' => 'POST',
    ),
  );
  return $form;
}