You are here

private function AdminSettingsForm::buildAdvancedForm in Acquia Lift Connector 8.4

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

Display advanced form.

Return value

array The render array for the advanced form.

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

File

src/Form/AdminSettingsForm.php, line 375

Class

AdminSettingsForm
Defines a form that configures settings.

Namespace

Drupal\acquia_lift\Form

Code

private function buildAdvancedForm() {
  $credential_settings = $this
    ->config('acquia_lift.settings')
    ->get('credential');
  $advanced_settings = $this
    ->config('acquia_lift.settings')
    ->get('advanced');

  // Bootstrap mode was introduced in a update. Instead of providing a update
  // hook, we just handle the "missing default value" case in code.
  if (!isset($advanced_settings['bootstrap_mode'])) {
    $advanced_settings['bootstrap_mode'] = 'auto';
  }
  $form = [
    '#title' => $this
      ->t('Advanced configuration'),
    '#type' => 'details',
    '#tree' => TRUE,
    '#open' => FALSE,
  ];
  $form['bootstrap_mode'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('Bootstrap Mode'),
    '#description' => $this
      ->t('"Auto" means Lift scripts will automatically bootstrap and act as quickly as possible. "Manual" means Lift scripts will load but withhold itself from collecting data, delivering content, and allowing admins to login; this option is useful when you want to do things on your site (e.g. check a cookie, set field value) before you want Lift to start bootstrapping; to resume Lift\'s bootstrapping process, call AcquiaLiftPublicApi.personalize().'),
    '#default_value' => $advanced_settings['bootstrap_mode'],
    '#options' => [
      'auto' => $this
        ->t('Auto'),
      'manual' => $this
        ->t('Manual'),
    ],
  ];
  $form['content_replacement_mode'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('Content replacement mode'),
    '#description' => $this
      ->t('The default, site-wide setting for <a href="https://docs.acquia.com/lift/exp-builder/config/modes/" target="_blank">content replacement mode</a>.'),
    '#default_value' => $advanced_settings['content_replacement_mode'],
    '#options' => [
      'trusted' => t('Trusted'),
      'customized' => t('Customized'),
    ],
  ];
  $form['cdf_version'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('CDF version'),
    '#description' => $this
      ->t('The default, site-wide setting for CDF version.'),
    '#default_value' => isset($advanced_settings['cdf_version']) ? $advanced_settings['cdf_version'] : SettingsHelper::CDF_VERSION_DEFAULT,
    '#options' => [
      1 => $this
        ->t('Version 1'),
      2 => $this
        ->t('Version 2'),
    ],
  ];
  $form['content_origins'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Origin Site UUIDs'),
    '#description' => $this
      ->t('Please leave this blank! This is an optional field and should be empty unless recommended otherwise by Acquia. Origins or Sources entered in this field will only be utilized during Personalization configuration & execution. Enter one origin site UUID per line.'),
    '#default_value' => $advanced_settings['content_origins'],
  ];
  return $form;
}