function protected function CdnAssets::sortThemes

8.x-3.x CdnAssets.php protected CdnAssets::sortThemes($a, $b)

Sorts themes.

Parameters

string $a: First theme to compare.

string $b: Second theme to compare.

Return value

false|int|string The comparision value, similar to other comparison functions.

Class

CdnAssets
Class CdnAssets.

Namespace

Drupal\bootstrap\Plugin\Provider

Source src/Plugin/Provider/CdnAssets.php (line 370)

protected function sortThemes($a, $b) {
  $order = ['bootstrap', 'bootstrap_theme'];
  $aIndex = array_search($a, $order);
  if ($aIndex === FALSE) {
    $aIndex = 2;
  }
  $bIndex = array_search($b, $order);
  if ($bIndex === FALSE) {
    $bIndex = 2;
  }
  if ($aIndex !== $bIndex) {
    return $aIndex - $bIndex;
  }
  return strnatcasecmp($a, $b);
}