You are here

public function RemoveHttpHeadersSettings::buildForm in Remove HTTP headers 8

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/RemoveHttpHeadersSettings.php, line 69

Class

RemoveHttpHeadersSettings
Form for the module settings.

Namespace

Drupal\remove_http_headers\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['headers_to_remove'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('HTTP headers'),
    '#description' => $this
      ->t('Add headers that should be removed from responses, one header per line.'),
    '#default_value' => implode("\n", $this->configManager
      ->getHeadersToRemove(TRUE)),
  ];
  $form['x_generator_info'] = [
    '#markup' => $this
      ->t("If the header <code>X-Generator</code> is configured for removal, Drupal's default <code>&lt;meta name='Generator' value='Drupal (version N)'&gt;</code> will be removed from HTML output."),
    '#prefix' => '<div class="description">',
    '#suffix' => '</div>',
  ];
  return parent::buildForm($form, $form_state);
}