You are here

private function AdminSettingsForm::buildAdvancedForm in Acquia Lift Connector 8.3

Same name and namespace in other branches
  1. 8.4 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 386

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/drupal/3/config/trusted" target="_blank">content replacement mode</a>.'),
    '#default_value' => $advanced_settings['content_replacement_mode'],
    '#options' => [
      'trusted' => $this
        ->t('Trusted'),
      'untrusted' => $this
        ->t('Untrusted'),
      'customized' => $this
        ->t('Customized'),
    ],
  ];
  $form['content_origin'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Content Hub Origin Site UUID'),
    '#description' => $this
      ->t('Show content in Experience Builder content list from only one origin site, specified by its Content Hub Site UUID. Leave empty to show content from all sites.'),
    '#default_value' => $credential_settings['content_origin'],
    '#required' => FALSE,
  ];
  return $form;
}