public function CdnWarmer::addMoreConfigurationFormElements in Warmer 2.x
Same name and namespace in other branches
- 8 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 136
Class
- CdnWarmer
- The cache warmer for the built-in entity cache.
Namespace
Drupal\warmer_cdn\Plugin\warmerCode
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,
];
$form['maxConcurrentRequests'] = [
'#type' => 'number',
'#min' => 1,
'#step' => 1,
'#title' => $this
->t('Maximum number of concurrent Requests.'),
'#description' => $this
->t('The maximum number of concurrent requests.'),
'#default_value' => empty($configuration['maxConcurrentRequests']) ? 10 : $configuration['maxConcurrentRequests'],
];
return $form;
}