You are here

function flexiform_field_max_weight in Flexiform 7

Get the max weight of fields in the flexiform

1 call to flexiform_field_max_weight()
flexiform_manage_form_fields_form in ./flexiform.admin.inc
flexiform_manage_form_fields_form

File

./flexiform.admin.inc, line 1623
Model type editing UI.

Code

function flexiform_field_max_weight($flexiform) {
  $max_weight = 0;
  foreach ($flexiform->elements as $element_namespace => $settings) {
    $weight = !empty($settings['weight']) ? $settings['weight'] : 0;
    if ($weight > $max_weight) {
      $max_weight = $weight;
    }
  }
  return $max_weight;
}