function Block::sortFieldsByWeight
Same name in other branches
- 4.0.x modules/ctools_views/src/Plugin/Display/Block.php \Drupal\ctools_views\Plugin\Display\Block::sortFieldsByWeight()
Sort field config array by weight.
Parameters
int $a: The field a.
int $b: The field b.
Return value
int Return the more weight
File
-
modules/
ctools_views/ src/ Plugin/ Display/ Block.php, line 819
Class
- Block
- Provides a Block display plugin.
Namespace
Drupal\ctools_views\Plugin\DisplayCode
public static function sortFieldsByWeight($a, $b) {
$a_weight = $a['weight'] ?? 0;
$b_weight = $b['weight'] ?? 0;
if ($a_weight == $b_weight) {
return 0;
}
return $a_weight < $b_weight ? -1 : 1;
}