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.


string $version: The version to map.

Return value

string The mapped version.

Overrides ProviderBase::mapVersion


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



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
  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;