You are here

public static function SettingManager::sort in Express 8

Sorts a structured array by either a set 'weight' property or by the ID.

Parameters

array $a: First item for comparison.

array $b: Second item for comparison.

Return value

int The comparison result for uasort().

File

themes/contrib/bootstrap/src/Plugin/SettingManager.php, line 63
Contains \Drupal\bootstrap\Plugin\SettingManager.

Class

SettingManager
Manages discovery and instantiation of Bootstrap theme settings.

Namespace

Drupal\bootstrap\Plugin

Code

public static function sort(array $a, array $b) {
  if (isset($a['weight']) || isset($b['weight'])) {
    return SortArray::sortByWeightElement($a, $b);
  }
  else {
    return SortArray::sortByKeyString($a, $b, 'id');
  }
}