You are here

private static function CustomSearchBlock::weightsSort in Custom Search 8

Helper function for sorting elements in the ordering table.

Parameters

mixed $a: The first value to compare.

mixed $b: The second value to compare.

Return value

int An integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.

File

src/Plugin/Block/CustomSearchBlock.php, line 1298

Class

CustomSearchBlock
Provides a 'Custom Search form' block.

Namespace

Drupal\custom_search\Plugin\Block

Code

private static function weightsSort($a, $b) {
  $config_a = $a['config'];
  $config_b = $b['config'];
  if ($config_a['weight'] == $config_b['weight']) {
    return 0;
  }
  return $config_a['weight'] < $config_b['weight'] ? -1 : 1;
}