function protected function ApiProviderBase::mapVersion

8.x-3.x ApiProviderBase.php protected ApiProviderBase::mapVersion($version, $library = NULL)

Allows providers a way to map a version to a different version.

Parameters

string $version: The version to map.

Return value

string The mapped version.

Overrides ProviderBase::mapVersion

Class

ApiProviderBase
CDN Provider base that uses an API to populate its assets.

Namespace

Drupal\bootstrap\Plugin\Provider

Source src/Plugin/Provider/ApiProviderBase.php (line 187)

protected function mapVersion($version, $library = NULL) {
  $mapped = [];

  // While the Bootswatch project attempts to maintain version parity with
  // Bootstrap, it doesn't always happen. This causes issues when the system
  // expects a 1:1 version match between Bootstrap and Bootswatch.
  // @see https://github.com/thomaspark/bootswatch/issues/892#ref-issue-410070082
  if ($library === 'bootswatch') {
    // This version is "broken" because of jsDelivr's API limit.
    $mapped['3.4.1'] = '3.4.0';
    // This version doesn't exist.
    $mapped['3.1.1'] = '3.2.0';
  }

  return isset($mapped[$version]) ? $mapped[$version] : $version;
}