You are here

protected function SettingsForm::buildApiCredentialsSection in CloudFlare 8

Builds credentials section for inclusion in the settings form.

Parameters

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

Return value

array Form Api render array with credentials section.

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

File

src/Form/SettingsForm.php, line 184

Class

SettingsForm
Class SettingsForm.

Namespace

Drupal\cloudflare\Form

Code

protected function buildApiCredentialsSection(Config $config) {
  $section = [];
  $section['api_credentials_fieldset'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('API Credentials'),
  ];
  $section['api_credentials_fieldset']['apikey'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('CloudFlare API Key'),
    '#description' => $this
      ->t('Your API key. Get it at <a href="https://www.cloudflare.com/a/account/my-account">cloudflare.com/a/account/my-account</a>.'),
    '#default_value' => $config
      ->get('apikey'),
    '#required' => TRUE,
  ];
  $section['api_credentials_fieldset']['email'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Account e-mail address'),
    '#default_value' => $config
      ->get('email'),
    '#required' => TRUE,
  ];
  return $section;
}