You are here

private function AdminSettingsForm::buildCredentialForm in Acquia Lift Connector 8.4

Same name and namespace in other branches
  1. 8 src/Form/AdminSettingsForm.php \Drupal\acquia_lift\Form\AdminSettingsForm::buildCredentialForm()
  2. 8.3 src/Form/AdminSettingsForm.php \Drupal\acquia_lift\Form\AdminSettingsForm::buildCredentialForm()

Build credential form.

Return value

array Credential form.

1 call to AdminSettingsForm::buildCredentialForm()
AdminSettingsForm::buildForm in src/Form/AdminSettingsForm.php
Form constructor.

File

src/Form/AdminSettingsForm.php, line 125

Class

AdminSettingsForm
Defines a form that configures settings.

Namespace

Drupal\acquia_lift\Form

Code

private function buildCredentialForm() {
  $credential_settings = $this
    ->config('acquia_lift.settings')
    ->get('credential');
  $form = [
    '#title' => $this
      ->t('Acquia Lift Credential'),
    '#type' => 'details',
    '#tree' => TRUE,
    '#open' => SettingsHelper::isInvalidCredential($credential_settings),
  ];
  $form['account_id'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Account ID'),
    '#description' => $this
      ->t('Your Lift subscription\'s account ID.'),
    '#default_value' => $credential_settings['account_id'],
    '#required' => TRUE,
  ];
  $form['site_id'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Site ID'),
    '#description' => $this
      ->t('Current site\'s site ID. WARNING: different sites must use different value here, even between a staging and a production of the same site.'),
    '#default_value' => $credential_settings['site_id'],
    '#required' => TRUE,
  ];
  $form['assets_url'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Assets URL'),
    '#description' => $this
      ->t('Your Lift application\'s assets URL. It determines which version of the Lift application is being used.'),
    '#field_prefix' => 'https://',
    '#default_value' => $this
      ->cleanUrl($credential_settings['assets_url']),
    '#required' => TRUE,
  ];
  $form['decision_api_url'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Decision API URL'),
    '#description' => $this
      ->t('Your Lift Decision API\'s URL.'),
    '#field_prefix' => 'https://',
    '#default_value' => !empty($credential_settings['decision_api_url']) ? $this
      ->cleanUrl($credential_settings['decision_api_url']) : 'us-east-1-decisionapi.lift.acquia.com',
    '#required' => TRUE,
  ];
  return $form;
}