function _field_multiple_value_form_sort_helper

_field_multiple_value_form_sort_helper($a, $b)

Callback for usort() within template_preprocess_field_multiple_value_form().

Sorts using ['_weight']['#value']

File

core/includes/theme.inc, line 1706
The theme system, which controls the output of Drupal.

Code

function _field_multiple_value_form_sort_helper($a, $b) {
  $a_weight = (is_array($a) && isset($a['_weight']['#value']) ? $a['_weight']['#value'] : 0);
  $b_weight = (is_array($b) && isset($b['_weight']['#value']) ? $b['_weight']['#value'] : 0);
  return $a_weight - $b_weight;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!includes!theme.inc/function/_field_multiple_value_form_sort_helper/8.1.x