You are here

public function JanrainCaptureSettingsForm::buildForm in Janrain Registration 8

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides ConfigFormBase::buildForm

File

src/Form/JanrainCaptureSettingsForm.php, line 70

Class

JanrainCaptureSettingsForm
Janrain Capture settings form.

Namespace

Drupal\janrain_capture\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = parent::buildForm($form, $form_state);
  $config = $this
    ->config('janrain_capture.settings');
  $form['capture'] = [
    '#type' => 'fieldset',
    '#tree' => TRUE,
    '#title' => $this
      ->t('Janrain Capture settings'),
  ];
  $form['capture']['app_id'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Application ID'),
    '#description' => $this
      ->t('The Capture application ID that represents a specific capture app.'),
    '#default_value' => $config
      ->get('capture.app_id'),
  ];
  $form['capture']['client_id'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Client ID'),
    '#description' => $this
      ->t('A client ID from your Registration application.'),
    '#default_value' => $config
      ->get('capture.client_id'),
  ];
  $form['capture']['client_secret'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Client Secret'),
    '#description' => $this
      ->t('A client secret from your Registration application'),
    '#default_value' => $config
      ->get('capture.client_secret'),
  ];
  $form['capture']['load_js_url'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Load.js file URL'),
    '#description' => $this
      ->t('Application load file (load.js)'),
    '#default_value' => $config
      ->get('capture.load_js_url'),
  ];
  $form['capture']['capture_server'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Capture server URL'),
    '#description' => $this
      ->t('The URL of the server hosting the Registration application.For example, https://myapp.janraincapture.com.'),
    '#default_value' => $config
      ->get('capture.capture_server'),
  ];
  $form['capture']['providers'] = [
    '#type' => 'details',
    '#open' => FALSE,
    '#title' => $this
      ->t('Social login'),
    '#collapsible' => TRUE,
    '#description' => $this
      ->t('Social login enables users to register on your web site by using an account created with a third-party identity provider (IDP). Read more in the <a href="@documentation">official documentation</a>.', [
      '@documentation' => 'https://docs.janrain.com/social/identity-providers',
    ]),
  ];
  $form['capture']['providers']['list'] = [
    '#type' => 'checkboxes',
    '#title' => $this
      ->t('Identity providers'),
    '#options' => static::SOCIAL_IDENTITY_PROVIDERS,
    '#default_value' => $config
      ->get('capture.providers'),
  ];
  $form['capture']['engage'] = [
    '#type' => 'details',
    '#open' => FALSE,
    '#title' => $this
      ->t('Engage Settings (optional)'),
    '#collapsible' => TRUE,
  ];
  $form['capture']['engage']['app_url'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Engage App URL'),
    '#description' => $this
      ->t('The URL of the Janrain Engage Single Sign-on server. For example, myapp.rpxnow.com.'),
    '#default_value' => $config
      ->get('capture.app_url'),
  ];
  $form['capture']['engage']['token_action'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Engage Token Action'),
    '#description' => $this
      ->t('The Token Action of the Janrain Engage Single Sign-on server. For example, "event".'),
    '#default_value' => $config
      ->get('capture.token_action'),
  ];
  $form['capture']['federate'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Federate Settings (optional)'),
    '#collapsible' => TRUE,
    '#open' => $config
      ->get('capture.enable_sso'),
  ];
  $form['capture']['federate']['enable_sso'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Enable SSO'),
    '#description' => $this
      ->t('Enable Single Sign On.'),
    '#default_value' => $config
      ->get('capture.enable_sso'),
  ];
  $form['capture']['federate']['federate_server'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Federate Server'),
    '#description' => $this
      ->t('The URL of the Janrain Single Sign-on server. For example, myapp.janrainsso.com.'),
    '#default_value' => $config
      ->get('capture.federate_server'),
  ];
  $form['capture']['federate']['federate_segment'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Federate segment'),
    '#description' => $this
      ->t('Specifies which SSO segment the current property belongs in.'),
    '#default_value' => $config
      ->get('capture.federate_segment'),
  ];
  $form['capture']['federate']['federate_supported_segments'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('SSO Supported Segment Names'),
    '#default_value' => $config
      ->get('capture.federate_supported_segments'),
    '#description' => $this
      ->t('Segments that the current site is allowed to federate with using Single Sign-on.'),
  ];
  return $form;
}