You are here

protected function SettingsForm::buildGeneralConfig in CloudFlare 8

Builds general config section for inclusion in the settings form.

Parameters

\Drupal\Core\Config\Config $config: The readonly configuration.

Return value

array Form API render array with selection section.

1 call to SettingsForm::buildGeneralConfig()
SettingsForm::buildForm in src/Form/SettingsForm.php
Form constructor.

File

src/Form/SettingsForm.php, line 274

Class

SettingsForm
Class SettingsForm.

Namespace

Drupal\cloudflare\Form

Code

protected function buildGeneralConfig(Config $config) {
  $section = [];
  $section['cloudflare_config'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Configuration'),
  ];
  $section['cloudflare_config']['client_ip_restore_enabled'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Restore Client Ip Address'),
    '#description' => $this
      ->t('CloudFlare operates as a reverse proxy and replaces the client IP address. This setting will restore it.<br /> Read more <a href="https://support.cloudflare.com/hc/en-us/articles/200170986-How-does-CloudFlare-handle-HTTP-Request-headers-">here</a>.'),
    '#default_value' => $config
      ->get('client_ip_restore_enabled'),
  ];
  $section['cloudflare_config']['bypass_host'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Host to Bypass CloudFlare'),
    '#description' => $this
      ->t('Optional: Specify a host (no http/https) used for authenticated users to edit the site that bypasses CloudFlare. <br /> This will help suppress log warnings regarding requests bypassing CloudFlare.'),
    '#default_value' => $config
      ->get('bypass_host'),
  ];
  return $section;
}