function _field_multiple_value_form_sort_helper

Same name in other branches
  1. 8.9.x core/includes/theme.inc \_field_multiple_value_form_sort_helper()
  2. 10 core/includes/theme.inc \_field_multiple_value_form_sort_helper()
  3. 11.x core/includes/theme.inc \_field_multiple_value_form_sort_helper()

Callback for usort() within template_preprocess_field_multiple_value_form().

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

2 string references to '_field_multiple_value_form_sort_helper'
template_preprocess_field_multiple_value_form in core/includes/theme.inc
Prepares variables for individual form element templates.
template_preprocess_file_widget_multiple in core/modules/file/file.field.inc
Prepares variables for multi file form widget templates.

File

core/includes/theme.inc, line 1988

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.