You are here

public function ServiceSettingsForm::buildForm in Services 8.4

Same name and namespace in other branches
  1. 9.0.x src/Form/ServiceSettingsForm.php \Drupal\services\Form\ServiceSettingsForm::buildForm()

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides ConfigFormBase::buildForm

File

src/Form/ServiceSettingsForm.php, line 32

Class

ServiceSettingsForm
Class \Drupal\services\Form\ServiceSettingsForm.

Namespace

Drupal\services\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->getConfig();
  $form['default_formats'] = [
    '#type' => 'checkboxes',
    '#title' => $this
      ->t('Default formats'),
    '#description' => $this
      ->t('Check all HTTP response formats you want
        enabled by default.'),
    '#options' => $this
      ->getFormatOptions(),
    '#default_value' => $config
      ->get('default_formats'),
  ];
  $form['default_authentication'] = [
    '#type' => 'checkboxes',
    '#title' => $this
      ->t('Default authentication'),
    '#description' => $this
      ->t('Check all authentication providers you want
        enabled by default'),
    '#options' => $this
      ->getAuthOptions(),
    '#default_value' => $config
      ->get('default_authentication'),
  ];
  $form['default_no_cache'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Disable cache'),
    '#description' => $this
      ->t('Do not cache the response of the resources by default.'),
    '#default_value' => $config
      ->get('default_no_cache'),
  ];
  return parent::buildForm($form, $form_state);
}