You are here

private function CerPresetFinder::_sort in Corresponding Entity References 7.3

File

includes/CerPresetFinder.inc, line 75

Class

CerPresetFinder
This class is a unified way for CER to find the presets that apply to a given entity. The result set is segmented into two parts: presets where the entity is on the left side, and bidirectional presets with the entity on the right side (i.e., the ones…

Code

private function _sort(CerPreset $a, CerPreset $b) {
  $a_weight = $a->wrapper->cer_weight
    ->value();
  $b_weight = $b->wrapper->cer_weight
    ->value();
  if ($a_weight > $b_weight) {
    return 1;
  }
  elseif ($b_weight > $a_weight) {
    return -1;
  }
  else {
    return 0;
  }
}