You are here

public function CdnWarmer::addMoreConfigurationFormElements in Warmer 8

Same name and namespace in other branches
  1. 2.x modules/warmer_cdn/src/Plugin/warmer/CdnWarmer.php \Drupal\warmer_cdn\Plugin\warmer\CdnWarmer::addMoreConfigurationFormElements()

Adds additional form elements to the configuration form.

Parameters

array $form: The configuration form to alter for the this plugin settings.

\Drupal\Core\Form\SubformStateInterface $form_state: The form state for the plugin settings.

Return value

array The form with additional elements.

Overrides WarmerInterface::addMoreConfigurationFormElements

File

modules/warmer_cdn/src/Plugin/warmer/CdnWarmer.php, line 124

Class

CdnWarmer
The cache warmer for the built-in entity cache.

Namespace

Drupal\warmer_cdn\Plugin\warmer

Code

public function addMoreConfigurationFormElements(array $form, SubformStateInterface $form_state) {
  $configuration = $this
    ->getConfiguration();
  $form['urls'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('URLs'),
    '#description' => $this
      ->t('Enter the list of URLs. One on each line. Examples: https://example.org/foo/bar, /foo/bar.'),
    '#default_value' => empty($configuration['urls']) ? '' : implode("\n", $configuration['urls']),
  ];
  $form['headers'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Headers'),
    '#description' => $this
      ->t('Specific headers to use when making HTTP requests. Format: <code>Header-Name: value1; value2</code>'),
    '#default_value' => empty($configuration['headers']) ? '' : implode("\n", $configuration['headers']),
  ];
  $form['verify'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Enable SSL verification'),
    '#description' => $this
      ->t('Enable SSL verification. Recommended to keep it checked for security reasons.'),
    '#default_value' => isset($configuration['verify']) ? $configuration['verify'] : TRUE,
  ];
  return $form;
}