You are here

private function AdminSettingsForm::buildCredentialForm in Acquia Lift Connector 8

Same name and namespace in other branches
  1. 8.4 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 93
Contains \Drupal\acquia_lift\Form\AdminSettingsForm.

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' => t('Credential'),
    '#type' => 'details',
    '#tree' => TRUE,
    '#open' => SettingsHelper::isInvalidCredential($credential_settings),
  ];
  $form['account_name'] = [
    '#type' => 'textfield',
    '#title' => t('Account Name'),
    '#default_value' => $credential_settings['account_name'],
    '#required' => TRUE,
  ];
  $form['customer_site'] = [
    '#type' => 'textfield',
    '#title' => t('Customer Site'),
    '#default_value' => $credential_settings['customer_site'],
  ];
  $form['api_url'] = [
    '#type' => 'textfield',
    '#title' => t('API URL'),
    '#field_prefix' => 'http(s)://',
    '#default_value' => $credential_settings['api_url'],
    '#required' => TRUE,
  ];
  $form['access_key'] = [
    '#type' => 'textfield',
    '#title' => t('API Access Key'),
    '#default_value' => $credential_settings['access_key'],
    '#required' => TRUE,
  ];
  $form['secret_key'] = [
    '#type' => 'password',
    '#title' => t('API Secret Key'),
    '#default_value' => $credential_settings['secret_key'],
    '#required' => empty($credential_settings['secret_key']),
    '#description' => !empty($credential_settings['secret_key']) ? t('Only necessary if updating') : '',
  ];
  $form['js_path'] = [
    '#type' => 'textfield',
    '#title' => t('JavaScript Path'),
    '#field_prefix' => 'http(s)://',
    '#default_value' => $credential_settings['js_path'],
    '#required' => TRUE,
  ];
  return $form;
}