public static function UCXF_FieldList::sort in Extra Fields Checkout Pane 7
Same name and namespace in other branches
- 6.2 class/UCXF_FieldList.class.php \UCXF_FieldList::sort()
Sort fields by weight.
This function is used as callback function by uasort().
This function is similar to element_sort().
@access public @static
Parameters
UCXF_Field $a: Instance of UCXF_Field
UCXF_Field $b: Instance of UCXF_Field
Return value
int
File
- class/
UCXF_FieldList.class.php, line 461 - Contains the UCXF_FieldList class.
Class
- UCXF_FieldList
- This class is used to keep track of all loaded fields in one request. It's also used as a central place to request fields.
Code
public static function sort(UCXF_Field $a, UCXF_Field $b) {
$a_weight = isset($a->weight) ? $a->weight : 0;
$b_weight = isset($b->weight) ? $b->weight : 0;
if ($a_weight == $b_weight) {
return 0;
}
return $a_weight < $b_weight ? -1 : 1;
}