You are here

protected function CdnSettingsForm::buildStreamWrapperCheckboxes in CDN 8.3

Builds the stream wrapper checkboxes form array.

Parameters

string[] $stream_wrapper_schemes: The stream wrapper schemes for which to generate form checkboxes.

Return value

array

1 call to CdnSettingsForm::buildStreamWrapperCheckboxes()
CdnSettingsForm::buildForm in cdn_ui/src/Form/CdnSettingsForm.php
Form constructor.

File

cdn_ui/src/Form/CdnSettingsForm.php, line 281

Class

CdnSettingsForm
Configure CDN settings for this site.

Namespace

Drupal\cdn_ui\Form

Code

protected function buildStreamWrapperCheckboxes(array $stream_wrapper_schemes) : array {
  $checkboxes = [];
  foreach ($stream_wrapper_schemes as $stream_wrapper_scheme) {
    $wrapper = $this->streamWrapperManager
      ->getViaScheme($stream_wrapper_scheme);
    $generates_external_urls = static::streamWrapperGeneratesExternalUrls($stream_wrapper_scheme, $wrapper);
    $checkboxes[$stream_wrapper_scheme] = [
      '#title' => $this
        ->t('@name → <code>@scheme://</code>', [
        '@scheme' => $stream_wrapper_scheme,
        '@name' => $wrapper
          ->getName(),
      ]),
      '#disabled' => $generates_external_urls,
      '#description' => !$generates_external_urls ? NULL : $this
        ->t('This stream wrapper generates external URLs, and hence cannot be served from a CDN.'),
    ];
  }
  return $checkboxes;
}