_field_sort_items_helper

  1. drupal
    1. 8
    2. 7
Versions
7 – 8 _field_sort_items_helper($a, $b)

Sort function for items order. (copied form element_sort(), which acts on #weight keys)

Related topics

Code

modules/field/field.module, line 548

<?php
function _field_sort_items_helper($a, $b) {
  $a_weight = (is_array($a) ? $a['_weight'] : 0);
  $b_weight = (is_array($b) ? $b['_weight'] : 0);
  return $a_weight - $b_weight;
}
?>