You are here

public function ServicesClientConnectionOAuthAuth::configForm in Services Client 7.2

Same name and namespace in other branches
  1. 7 services_client_connection/modules/services_client_oauth/plugins/ServicesClientConnectionOAuthAuth.inc \ServicesClientConnectionOAuthAuth::configForm()

Configuration form options

Overrides ServicesClientConnectionPlugin::configForm

File

services_client_connection/modules/services_client_oauth/plugins/ServicesClientConnectionOAuthAuth.inc, line 15

Class

ServicesClientConnectionOAuthAuth
OAuth authentication support

Code

public function configForm(&$form, &$form_state) {
  $form['add_token'] = array(
    '#type' => 'item',
    '#markup' => t('Authorize !connection or', array(
      '!connection' => l(t('connection'), 'services_client_oauth/request', array(
        'query' => array(
          'connection_name' => $this->connection->name,
        ),
      )),
    )),
  );
  $form['container'] = array(
    '#type' => 'fieldset',
    '#title' => empty($this->config) ? t('Enter keys manually') : t('oAuth Keys'),
    '#collapsible' => TRUE,
    '#collapsed' => empty($this->config),
    '#tree' => FALSE,
  );
  $form['container']['consumer_key'] = array(
    '#title' => t('Consumer Key'),
    '#type' => 'textfield',
    '#default_value' => !empty($this->config['consumer_key']) ? $this->config['consumer_key'] : '',
    '#required' => TRUE,
  );
  $form['container']['consumer_secret'] = array(
    '#title' => t('Consumer Secret'),
    '#type' => 'textfield',
    '#default_value' => !empty($this->config['consumer_secret']) ? $this->config['consumer_secret'] : '',
    '#required' => TRUE,
  );
  $form['container']['access_key'] = array(
    '#title' => t('Access Key'),
    '#type' => 'textfield',
    '#default_value' => !empty($this->config['access_key']) ? $this->config['access_key'] : '',
    '#description' => t('Access key is optional. If you want to use 2 legged oauth leave access key and secret empty.'),
  );
  $form['container']['access_secret'] = array(
    '#title' => t('Access Secret'),
    '#type' => 'textfield',
    '#default_value' => !empty($this->config['access_secret']) ? $this->config['access_secret'] : '',
  );
  $form['container']['force_port'] = array(
    '#title' => t('Force Port'),
    '#type' => 'textfield',
    '#default_value' => isset($this->config['force_port']) ? $this->config['force_port'] : '',
    '#description' => t('If required force port in URL which is used for calculating signature. I.e. 80 for https connection.'),
  );
}