You are here

function _mathfield_order_by_dependency in Math Field 7

Order mathfield elemnets based on dependencies.

Callback for usort() within mathfield_form_afterbuild().

1 string reference to '_mathfield_order_by_dependency'
mathfield_form_afterbuild in ./mathfield.module
Afterbuild callbcak for forms with math expression fields.

File

./mathfield.module, line 626
Adds a dynamic math expression field.

Code

function _mathfield_order_by_dependency($a, $b) {
  $field_a = $a['#field_name'];
  $b_dependencies = $b['#settings']['field_dependencies'];
  if (in_array($field_a, $b_dependencies)) {
    return -1;
  }
  return 1;
}